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
|
@ -4191,6 +4191,7 @@ extern void *k_calloc(size_t nmemb, size_t size);
|
|||
/* private - implementation data created as needed, per-type */
|
||||
struct _poller {
|
||||
struct k_thread *thread;
|
||||
volatile int is_polling;
|
||||
};
|
||||
|
||||
/* private - types bit positions */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue