Function riot_sys::event_wait_multi

source ·
pub unsafe extern "C" fn event_wait_multi(
    queues: *mut event_queue_t,
    n_queues: size_t
) -> *mut event_t
Expand description

@brief Get next event from the given event queues, blocking

This function will block until an event becomes available. If more than one queue contains an event, the queue with the lowest index is chosen. Thus, a lower index in the @p queues array translates into a higher priority of the queue.

In order to handle an event retrieved using this function, call event->handler(event).

@warning There can only be a single waiter on a queue!

@note This function can be suitable for having a single thread handling both real-time and non-real-time events. However, a real time event can be delayed for the whole duration a single non-real-time event takes (in addition to all other sources of latency). Thus, the slowest to handle non-real-time event must still execute fast enough to add an amount of latency (on top of other sources of latency) that is acceptable to the real-time event with the strictest requirements.

@pre 0 < @p n_queues (expect blowing assert() otherwise) @pre The queue must have a waiter (i.e. it should have been claimed, or initialized using @ref event_queue_init, @ref event_queues_init)

@param[in] queues Array of event queues to get event from @param[in] n_queues Number of event queues passed in @p queues

@returns pointer to next event