Lines Matching full:thread
28 * thread->next_thread (until NULL)
35 /* clean up when a thread is aborted */
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()
105 static inline bool z_is_thread_timeout_active(struct k_thread *thread) in z_is_thread_timeout_active() argument
107 return !z_is_inactive_timeout(&thread->base.timeout); in z_is_thread_timeout_active()
110 static inline bool z_is_thread_ready(struct k_thread *thread) in z_is_thread_ready() argument
112 return !((z_is_thread_prevented_from_running(thread)) != 0U || in z_is_thread_ready()
113 z_is_thread_timeout_active(thread)); in z_is_thread_ready()
116 static inline bool z_has_thread_started(struct k_thread *thread) in z_has_thread_started() argument
118 return (thread->base.thread_state & _THREAD_PRESTART) == 0U; in z_has_thread_started()
121 static inline bool z_is_thread_state_set(struct k_thread *thread, uint32_t state) in z_is_thread_state_set() argument
123 return (thread->base.thread_state & state) != 0U; in z_is_thread_state_set()
126 static inline bool z_is_thread_queued(struct k_thread *thread) in z_is_thread_queued() argument
128 return z_is_thread_state_set(thread, _THREAD_QUEUED); in z_is_thread_queued()
131 static inline void z_mark_thread_as_suspended(struct k_thread *thread) in z_mark_thread_as_suspended() argument
133 thread->base.thread_state |= _THREAD_SUSPENDED; in z_mark_thread_as_suspended()
135 SYS_PORT_TRACING_FUNC(k_thread, sched_suspend, thread); in z_mark_thread_as_suspended()
138 static inline void z_mark_thread_as_not_suspended(struct k_thread *thread) in z_mark_thread_as_not_suspended() argument
140 thread->base.thread_state &= ~_THREAD_SUSPENDED; in z_mark_thread_as_not_suspended()
142 SYS_PORT_TRACING_FUNC(k_thread, sched_resume, thread); in z_mark_thread_as_not_suspended()
145 static inline void z_mark_thread_as_started(struct k_thread *thread) in z_mark_thread_as_started() argument
147 thread->base.thread_state &= ~_THREAD_PRESTART; in z_mark_thread_as_started()
150 static inline void z_mark_thread_as_pending(struct k_thread *thread) in z_mark_thread_as_pending() argument
152 thread->base.thread_state |= _THREAD_PENDING; in z_mark_thread_as_pending()
155 static inline void z_mark_thread_as_not_pending(struct k_thread *thread) in z_mark_thread_as_not_pending() argument
157 thread->base.thread_state &= ~_THREAD_PENDING; in z_mark_thread_as_not_pending()
161 * This function tags the current thread as essential to system operation.
162 * Exceptions raised by this thread will be treated as a fatal system error.
164 static inline void z_thread_essential_set(struct k_thread *thread) in z_thread_essential_set() argument
166 thread->base.user_options |= K_ESSENTIAL; in z_thread_essential_set()
170 * This function tags the current thread as not essential to system operation.
171 * Exceptions raised by this thread may be recoverable.
172 * (This is the default tag for a thread.)
174 static inline void z_thread_essential_clear(struct k_thread *thread) in z_thread_essential_clear() argument
176 thread->base.user_options &= ~K_ESSENTIAL; in z_thread_essential_clear()
180 * This routine indicates if the current thread is an essential system thread.
182 * Returns true if current thread is essential, false if it is not.
184 static inline bool z_is_thread_essential(struct k_thread *thread) in z_is_thread_essential() argument
186 return (thread->base.user_options & K_ESSENTIAL) == K_ESSENTIAL; in z_is_thread_essential()
190 static ALWAYS_INLINE bool should_preempt(struct k_thread *thread, in should_preempt() argument
194 * software state (e.g. the thread called k_yield()) in should_preempt()
207 /* Edge case on ARM where a thread can be pended out of an in should_preempt()
213 && z_is_thread_timeout_active(thread)) { in should_preempt()
217 /* Otherwise we have to be running a preemptible thread or in should_preempt()
220 if (thread_is_preemptible(_current) || thread_is_metairq(thread)) { in should_preempt()
233 static inline bool z_is_idle_thread_object(struct k_thread *thread) in z_is_idle_thread_object() argument
237 return thread->base.is_idle; in z_is_idle_thread_object()
239 return thread == &z_idle_threads[0]; in z_is_idle_thread_object()