kernel: add _THREAD_POLLING thread state

Will be needed for k_poll() API.

Change-Id: I0ebe4be5a9c56df2ebb8496dc49c894e982e6008
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
This commit is contained in:
Benjamin Walsh 2017-01-28 11:54:48 -05:00 committed by Anas Nashif
commit 0de9487351
2 changed files with 18 additions and 0 deletions

View file

@ -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 */

View file

@ -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
*