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:
Andy Ross 2018-05-31 11:58:09 -07:00 committed by Anas Nashif
commit 55a7e46b66
4 changed files with 7 additions and 46 deletions

View file

@ -45,9 +45,6 @@
/* 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)
/* Thread is present in the ready queue */
#define _THREAD_QUEUED (1 << 6)