Lines Matching refs:thread
38 void z_thread_monitor_exit(struct k_thread *thread);
40 #define z_thread_monitor_exit(thread) \ argument
46 static inline void thread_schedule_new(struct k_thread *thread, k_timeout_t delay) in thread_schedule_new() argument
50 k_thread_start(thread); in thread_schedule_new()
52 z_add_thread_timeout(thread, delay); in thread_schedule_new()
56 k_thread_start(thread); in thread_schedule_new()
60 static inline int thread_is_preemptible(struct k_thread *thread) in thread_is_preemptible() argument
63 return thread->base.preempt <= _PREEMPT_THRESHOLD; in thread_is_preemptible()
67 static inline int thread_is_metairq(struct k_thread *thread) in thread_is_metairq() argument
70 return (thread->base.prio - K_HIGHEST_THREAD_PRIO) in thread_is_metairq()
73 ARG_UNUSED(thread); in thread_is_metairq()
79 static inline bool is_thread_dummy(struct k_thread *thread) in is_thread_dummy() argument
81 return (thread->base.thread_state & _THREAD_DUMMY) != 0U; in is_thread_dummy()
86 static inline bool z_is_thread_suspended(struct k_thread *thread) in z_is_thread_suspended() argument
88 return (thread->base.thread_state & _THREAD_SUSPENDED) != 0U; in z_is_thread_suspended()
91 static inline bool z_is_thread_pending(struct k_thread *thread) in z_is_thread_pending() argument
93 return (thread->base.thread_state & _THREAD_PENDING) != 0U; in z_is_thread_pending()
96 static inline bool z_is_thread_prevented_from_running(struct k_thread *thread) in z_is_thread_prevented_from_running() argument
98 uint8_t state = thread->base.thread_state; in z_is_thread_prevented_from_running()
104 static inline bool z_is_thread_timeout_active(struct k_thread *thread) in z_is_thread_timeout_active() argument
106 return !z_is_inactive_timeout(&thread->base.timeout); in z_is_thread_timeout_active()
109 static inline bool z_is_thread_ready(struct k_thread *thread) in z_is_thread_ready() argument
111 return !z_is_thread_prevented_from_running(thread); in z_is_thread_ready()
114 static inline bool z_is_thread_state_set(struct k_thread *thread, uint32_t state) in z_is_thread_state_set() argument
116 return (thread->base.thread_state & state) != 0U; in z_is_thread_state_set()
119 static inline bool z_is_thread_queued(struct k_thread *thread) in z_is_thread_queued() argument
121 return z_is_thread_state_set(thread, _THREAD_QUEUED); in z_is_thread_queued()
124 static inline void z_mark_thread_as_queued(struct k_thread *thread) in z_mark_thread_as_queued() argument
126 thread->base.thread_state |= _THREAD_QUEUED; in z_mark_thread_as_queued()
129 static inline void z_mark_thread_as_not_queued(struct k_thread *thread) in z_mark_thread_as_not_queued() argument
131 thread->base.thread_state &= ~_THREAD_QUEUED; in z_mark_thread_as_not_queued()
134 static inline void z_mark_thread_as_suspended(struct k_thread *thread) in z_mark_thread_as_suspended() argument
136 thread->base.thread_state |= _THREAD_SUSPENDED; in z_mark_thread_as_suspended()
138 SYS_PORT_TRACING_FUNC(k_thread, sched_suspend, thread); in z_mark_thread_as_suspended()
141 static inline void z_mark_thread_as_not_suspended(struct k_thread *thread) in z_mark_thread_as_not_suspended() argument
143 thread->base.thread_state &= ~_THREAD_SUSPENDED; in z_mark_thread_as_not_suspended()
145 SYS_PORT_TRACING_FUNC(k_thread, sched_resume, thread); in z_mark_thread_as_not_suspended()
148 static inline void z_mark_thread_as_pending(struct k_thread *thread) in z_mark_thread_as_pending() argument
150 thread->base.thread_state |= _THREAD_PENDING; in z_mark_thread_as_pending()
153 static inline void z_mark_thread_as_not_pending(struct k_thread *thread) in z_mark_thread_as_not_pending() argument
155 thread->base.thread_state &= ~_THREAD_PENDING; in z_mark_thread_as_not_pending()
158 static inline bool z_is_thread_sleeping(struct k_thread *thread) in z_is_thread_sleeping() argument
160 return (thread->base.thread_state & _THREAD_SLEEPING) != 0U; in z_is_thread_sleeping()
163 static inline void z_mark_thread_as_sleeping(struct k_thread *thread) in z_mark_thread_as_sleeping() argument
165 thread->base.thread_state |= _THREAD_SLEEPING; in z_mark_thread_as_sleeping()
168 static inline void z_mark_thread_as_not_sleeping(struct k_thread *thread) in z_mark_thread_as_not_sleeping() argument
170 thread->base.thread_state &= ~_THREAD_SLEEPING; in z_mark_thread_as_not_sleeping()
177 static inline void z_thread_essential_set(struct k_thread *thread) in z_thread_essential_set() argument
179 thread->base.user_options |= K_ESSENTIAL; in z_thread_essential_set()
187 static inline void z_thread_essential_clear(struct k_thread *thread) in z_thread_essential_clear() argument
189 thread->base.user_options &= ~K_ESSENTIAL; in z_thread_essential_clear()
197 static inline bool z_is_thread_essential(struct k_thread *thread) in z_is_thread_essential() argument
199 return (thread->base.user_options & K_ESSENTIAL) == K_ESSENTIAL; in z_is_thread_essential()
203 static ALWAYS_INLINE bool should_preempt(struct k_thread *thread, in should_preempt() argument
223 if (thread_is_preemptible(_current) || thread_is_metairq(thread)) { in should_preempt()
233 && z_is_thread_timeout_active(thread)) { in should_preempt()
246 static inline bool z_is_idle_thread_object(struct k_thread *thread) in z_is_idle_thread_object() argument
250 return thread->base.is_idle; in z_is_idle_thread_object()
252 return thread == &z_idle_threads[0]; in z_is_idle_thread_object()