Lines Matching refs:thread

42 void z_thread_monitor_exit(struct k_thread *thread);
44 #define z_thread_monitor_exit(thread) \ argument
49 void z_thread_abort(struct k_thread *thread);
51 static inline void thread_schedule_new(struct k_thread *thread, k_timeout_t delay) in thread_schedule_new() argument
55 k_thread_start(thread); in thread_schedule_new()
57 z_add_thread_timeout(thread, delay); in thread_schedule_new()
61 k_thread_start(thread); in thread_schedule_new()
65 static inline int thread_is_preemptible(const struct k_thread *thread) in thread_is_preemptible() argument
68 return thread->base.preempt <= _PREEMPT_THRESHOLD; in thread_is_preemptible()
72 static inline int thread_is_metairq(const struct k_thread *thread) in thread_is_metairq() argument
75 return (thread->base.prio - K_HIGHEST_THREAD_PRIO) in thread_is_metairq()
78 ARG_UNUSED(thread); in thread_is_metairq()
83 static inline bool is_thread_dummy(const struct k_thread *thread) in is_thread_dummy() argument
85 return (thread->base.thread_state & _THREAD_DUMMY) != 0U; in is_thread_dummy()
88 static inline bool z_is_thread_suspended(const struct k_thread *thread) in z_is_thread_suspended() argument
90 return (thread->base.thread_state & _THREAD_SUSPENDED) != 0U; in z_is_thread_suspended()
93 static inline bool z_is_thread_pending(const struct k_thread *thread) in z_is_thread_pending() argument
95 return (thread->base.thread_state & _THREAD_PENDING) != 0U; in z_is_thread_pending()
98 static inline bool z_is_thread_dead(const struct k_thread *thread) in z_is_thread_dead() argument
100 return (thread->base.thread_state & _THREAD_DEAD) != 0U; in z_is_thread_dead()
104 static inline bool z_is_thread_aborting(const struct k_thread *thread) in z_is_thread_aborting() argument
106 return (thread->base.thread_state & _THREAD_ABORTING) != 0U; in z_is_thread_aborting()
110 static inline bool z_is_thread_halting(const struct k_thread *thread) in z_is_thread_halting() argument
112 return (thread->base.thread_state & in z_is_thread_halting()
117 static inline bool z_is_thread_prevented_from_running(const struct k_thread *thread) in z_is_thread_prevented_from_running() argument
119 uint8_t state = thread->base.thread_state; in z_is_thread_prevented_from_running()
125 static inline bool z_is_thread_timeout_active(const struct k_thread *thread) in z_is_thread_timeout_active() argument
127 return !z_is_inactive_timeout(&thread->base.timeout); in z_is_thread_timeout_active()
130 static inline bool z_is_thread_ready(const struct k_thread *thread) in z_is_thread_ready() argument
132 return !z_is_thread_prevented_from_running(thread); in z_is_thread_ready()
135 static inline bool z_is_thread_state_set(const struct k_thread *thread, uint32_t state) in z_is_thread_state_set() argument
137 return (thread->base.thread_state & state) != 0U; in z_is_thread_state_set()
140 static inline bool z_is_thread_queued(const struct k_thread *thread) in z_is_thread_queued() argument
142 return z_is_thread_state_set(thread, _THREAD_QUEUED); in z_is_thread_queued()
145 static inline void z_mark_thread_as_queued(struct k_thread *thread) in z_mark_thread_as_queued() argument
147 thread->base.thread_state |= _THREAD_QUEUED; in z_mark_thread_as_queued()
150 static inline void z_mark_thread_as_not_queued(struct k_thread *thread) in z_mark_thread_as_not_queued() argument
152 thread->base.thread_state &= ~_THREAD_QUEUED; in z_mark_thread_as_not_queued()
155 static inline void z_mark_thread_as_suspended(struct k_thread *thread) in z_mark_thread_as_suspended() argument
157 thread->base.thread_state |= _THREAD_SUSPENDED; in z_mark_thread_as_suspended()
159 SYS_PORT_TRACING_FUNC(k_thread, sched_suspend, thread); in z_mark_thread_as_suspended()
162 static inline void z_mark_thread_as_not_suspended(struct k_thread *thread) in z_mark_thread_as_not_suspended() argument
164 thread->base.thread_state &= ~_THREAD_SUSPENDED; in z_mark_thread_as_not_suspended()
166 SYS_PORT_TRACING_FUNC(k_thread, sched_resume, thread); in z_mark_thread_as_not_suspended()
169 static inline void z_mark_thread_as_pending(struct k_thread *thread) in z_mark_thread_as_pending() argument
171 thread->base.thread_state |= _THREAD_PENDING; in z_mark_thread_as_pending()
174 static inline void z_mark_thread_as_not_pending(struct k_thread *thread) in z_mark_thread_as_not_pending() argument
176 thread->base.thread_state &= ~_THREAD_PENDING; in z_mark_thread_as_not_pending()
179 static inline bool z_is_thread_sleeping(struct k_thread *thread) in z_is_thread_sleeping() argument
181 return (thread->base.thread_state & _THREAD_SLEEPING) != 0U; in z_is_thread_sleeping()
184 static inline void z_mark_thread_as_sleeping(struct k_thread *thread) in z_mark_thread_as_sleeping() argument
186 thread->base.thread_state |= _THREAD_SLEEPING; in z_mark_thread_as_sleeping()
189 static inline void z_mark_thread_as_not_sleeping(struct k_thread *thread) in z_mark_thread_as_not_sleeping() argument
191 thread->base.thread_state &= ~_THREAD_SLEEPING; in z_mark_thread_as_not_sleeping()
198 static inline void z_thread_essential_set(struct k_thread *thread) in z_thread_essential_set() argument
200 thread->base.user_options |= K_ESSENTIAL; in z_thread_essential_set()
208 static inline void z_thread_essential_clear(struct k_thread *thread) in z_thread_essential_clear() argument
210 thread->base.user_options &= ~K_ESSENTIAL; in z_thread_essential_clear()
218 static inline bool z_is_thread_essential(const struct k_thread *thread) in z_is_thread_essential() argument
220 return (thread->base.user_options & K_ESSENTIAL) == K_ESSENTIAL; in z_is_thread_essential()
224 static ALWAYS_INLINE bool should_preempt(const struct k_thread *thread, in should_preempt() argument
244 if (thread_is_preemptible(_current) || thread_is_metairq(thread)) { in should_preempt()
254 && z_is_thread_timeout_active(thread)) { in should_preempt()
267 static inline bool z_is_idle_thread_object(const struct k_thread *thread) in z_is_idle_thread_object() argument
271 return thread->base.is_idle; in z_is_idle_thread_object()
273 return thread == &z_idle_threads[0]; in z_is_idle_thread_object()