Go to the documentation of this file.
112 #ifndef THREAD_FLAG_EVENT
116 #define THREAD_FLAG_EVENT (0x1)
122 #define EVENT_QUEUE_INIT { .waiter = thread_get_active() }
127 #define EVENT_QUEUE_INIT_DETACHED { .waiter = NULL }
167 assert(queues && n_queues);
169 for (
size_t i = 0; i < n_queues; i++) {
170 memset(&queues[i],
'\0',
sizeof(queues[0]));
197 for (
size_t i = 0; i < n_queues; i++) {
198 memset(&queues[i],
'\0',
sizeof(queues[0]));
227 for (
size_t i = 0; i < n_queues; i++) {
228 assert(queues[i].waiter == NULL);
334 #if defined(MODULE_XTIMER) || defined(DOXYGEN)
#define assert(cond)
abort the program if assertion is false
clist_node_t list_node
event queue list entry
static void event_queue_init(event_queue_t *queue)
Initialize an event queue.
void event_cancel(event_queue_t *queue, event_t *event)
Cancel a queued event.
POSIX.1-2008 compliant version of the assert macro.
static void event_loop(event_queue_t *queue)
Simple event loop.
static void event_queues_init(event_queue_t *queues, size_t n_queues)
Initialize an array of event queues.
event_t * event_wait_timeout(event_queue_t *queue, uint32_t timeout)
Get next event from event queue, blocking until timeout expires.
static thread_t * thread_get_active(void)
Returns a pointer to the Thread Control Block of the currently running thread.
static void event_queues_init_detached(event_queue_t *queues, size_t n_queues)
Initialize an array of event queues not binding it to a thread.
thread_t holds thread's context data.
static void event_queue_init_detached(event_queue_t *queue)
Initialize an event queue not binding it to a thread.
event_t * event_wait_multi(event_queue_t *queues, size_t n_queues)
Get next event from the given event queues, blocking.
void event_post(event_queue_t *queue, event_t *event)
Queue an event.
static void event_queues_claim(event_queue_t *queues, size_t n_queues)
Bind an array of event queues to the calling thread.
static event_t * event_wait(event_queue_t *queue)
Get next event from event queue, blocking.
clist_node_t event_list
list of queued events
thread_t * waiter
thread ownning event queue
event_handler_t handler
pointer to event handler function
event_t * event_get(event_queue_t *queue)
Get next event from event queue, non-blocking.
void(* event_handler_t)(event_t *)
event handler type definition
static void event_queue_claim(event_queue_t *queue)
Bind an event queue to the calling thread.
static void event_loop_multi(event_queue_t *queues, size_t n_queues)
Simple event loop with multiple queues.
event_t * event_wait_timeout64(event_queue_t *queue, uint64_t timeout)
Get next event from event queue, blocking until timeout expires.