diff --git a/kernel/include/kernel_structs.h b/kernel/include/kernel_structs.h index 174bac84565..f6c504f485d 100644 --- a/kernel/include/kernel_structs.h +++ b/kernel/include/kernel_structs.h @@ -39,6 +39,9 @@ /* Thread is suspended */ #define _THREAD_SUSPENDED (1 << 4) +/* Thread is actively looking at events to see if they are ready */ +#define _THREAD_POLLING (1 << 5) + /* end - states */ diff --git a/kernel/include/ksched.h b/kernel/include/ksched.h index 12f42c37a57..00f916b84f1 100644 --- a/kernel/include/ksched.h +++ b/kernel/include/ksched.h @@ -346,6 +346,21 @@ static inline int _is_thread_pending(struct k_thread *thread) return !!(thread->base.thread_state & _THREAD_PENDING); } +static inline void _mark_thread_as_polling(struct k_thread *thread) +{ + _set_thread_states(thread, _THREAD_POLLING); +} + +static inline void _mark_thread_as_not_polling(struct k_thread *thread) +{ + _reset_thread_states(thread, _THREAD_POLLING); +} + +static inline int _is_thread_polling(struct k_thread *thread) +{ + return _is_thread_state_set(thread, _THREAD_POLLING); +} + /** * @brief Mark a thread as started *