zephyr/kernel
Benjamin Walsh acc68c1e59 kernel: add k_poll() API
k_poll() is similar to the POSIX poll() API in spirit in that it allows
a single thread to monitor multiple events without actively polling
them, but rather pending for one or more to become ready. Such events
can be a direct event, or kernel objects (currently only semaphores and
fifos).

When a kernel object being polled on is ready, it is not "given" to the
poller: the poller must then acquire it via the regular API for the
object (e.g. k_sem_take()). Only one thread can poll on a particular
object at one time. These restrictions mean that k_poll() is most
effective when a single thread monitors multiple events that are not
subject for contention. For example, being the sole reader on multiple
fifos, or the only thread being signalled by multiple semaphores, or a
combination of both.

Change-Id: I7035a9baf4aa016fb87afc5f5c0f5f8cb216480f
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-02-02 00:30:00 +00:00
..
configs kernel: add LEGACY_KERNEL option 2017-01-09 19:42:13 +00:00
include kernel: add _WAIT_Q_INIT() 2017-02-02 00:30:00 +00:00
alert.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
atomic_c.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
compiler_stack_protect.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
device.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
errno.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
fifo.c kernel: add k_poll() API 2017-02-02 00:30:00 +00:00
idle.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
init.c kernel/arch: streamline thread user options 2017-01-24 13:34:50 +00:00
int_latency_bench.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
Kconfig kernel: add k_poll() API 2017-02-02 00:30:00 +00:00
Kconfig.event_logger license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
Kconfig.power_mgmt license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
legacy_offload.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
legacy_timer.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
lifo.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
mailbox.c kernel: rename thread states symbols 2017-01-24 13:34:49 +00:00
Makefile kernel: add k_poll() API 2017-02-02 00:30:00 +00:00
mem_pool.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
mem_slab.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
msg_q.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
mutex.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
pipes.c kernel: rename thread states symbols 2017-01-24 13:34:49 +00:00
poll.c kernel: add k_poll() API 2017-02-02 00:30:00 +00:00
sched.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
sem.c kernel: add k_poll() API 2017-02-02 00:30:00 +00:00
stack.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
sys_clock.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
system_work_q.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
thread_abort.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
thread.c kernel/arch: streamline thread user options 2017-01-24 13:34:50 +00:00
timer.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
version.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
work_q.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00