kernel: Separate k_poll() infrastructure and implementation

This commit separates k_poll() infrastructure from k_poll() API
implementation, allowing other (future) API calls to use the same
framework.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
This commit is contained in:
Piotr Zięcik 2019-08-27 12:19:26 +02:00 committed by Carles Cufí
commit 1c4177d10f
2 changed files with 82 additions and 54 deletions

View file

@ -2682,6 +2682,14 @@ __syscall int k_stack_pop(struct k_stack *stack, stack_data_t *data, s32_t timeo
struct k_work;
/* private, used by k_poll */
typedef int (*_poller_cb_t)(struct k_poll_event *event, u32_t state);
struct _poller {
volatile bool is_polling;
struct k_thread *thread;
_poller_cb_t cb;
};
/**
* @addtogroup thread_apis
* @{
@ -4313,12 +4321,6 @@ extern void *k_calloc(size_t nmemb, size_t size);
#define _INIT_OBJ_POLL_EVENT(obj) do { } while (false)
#endif
/* private - implementation data created as needed, per-type */
struct _poller {
struct k_thread *thread;
volatile bool is_polling;
};
/* private - types bit positions */
enum _poll_types_bits {
/* can be used to ignore an event */