From 0de94873516008bbc55f7385c89d5ab5b9df2118 Mon Sep 17 00:00:00 2001 From: Benjamin Walsh Date: Sat, 28 Jan 2017 11:54:48 -0500 Subject: [PATCH] kernel: add _THREAD_POLLING thread state Will be needed for k_poll() API. Change-Id: I0ebe4be5a9c56df2ebb8496dc49c894e982e6008 Signed-off-by: Benjamin Walsh --- kernel/include/kernel_structs.h | 3 +++ kernel/include/ksched.h | 15 +++++++++++++++ 2 files changed, 18 insertions(+) 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 *