kernel/poll: Remove POLLING thread state bit
The _THREAD_POLLING bit in thread_state was never actually a legitimate thread "state". It is a clever synchronization trick introduced to allow the thread to release the irq_lock while looping over the input event array without dropping events. Instead, make that flag a word in the "poller" struct that lives on the stack of the thread calling k_poll. The disadvantage is the 4 bytes of thread space needed. Advantages: + Cleaner API, it's now internal to poll instead of being globally visible. + The thread_state bit space is just one byte, and was almost full already. + Smaller code to write/test a full word and not a bitfield + Words are atomic, so no need for one of irq lock/unlock pairs. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
59309c1a2d
commit
55a7e46b66
4 changed files with 7 additions and 46 deletions
|
@ -107,11 +107,6 @@ static inline int _is_thread_state_set(struct k_thread *thread, u32_t state)
|
|||
return !!(thread->base.thread_state & state);
|
||||
}
|
||||
|
||||
static inline int _is_thread_polling(struct k_thread *thread)
|
||||
{
|
||||
return _is_thread_state_set(thread, _THREAD_POLLING);
|
||||
}
|
||||
|
||||
static inline int _is_thread_queued(struct k_thread *thread)
|
||||
{
|
||||
return _is_thread_state_set(thread, _THREAD_QUEUED);
|
||||
|
@ -153,16 +148,6 @@ static inline void _reset_thread_states(struct k_thread *thread,
|
|||
thread->base.thread_state &= ~states;
|
||||
}
|
||||
|
||||
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 void _mark_thread_as_queued(struct k_thread *thread)
|
||||
{
|
||||
_set_thread_states(thread, _THREAD_QUEUED);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue