When using static initializers uninitialized fields are set to 0, or
NULL for pointers. But when using event_callback_init() on non
static variables event_callback_t structure may hold non 0 values.
This will lead to the event never being called since if super.list_node.next
is not NULL as it is considered already in the event queue and therefore
not touched.
The callback function of `ztimer_periodic` is only expected to have
two states.
So let it return `true` if the timer should keep repeating, `false`
otherwise.
This PR makes `event_timeout` and `event_timeout_ztimer` two distinct
pseudomodules, where the only api difference is in the init function.
If only `event_timeout_ztimer` is selected then no default ZTIMER
backend is selected and the old init function is not implemented.
If only `event_timeout` is selected then `xtimer` is used unless
`ztimer_usec` is included. In which case the `xtimer` wrapper on top
of `ztimer` is used and `xtimer` is not directly selected. This
allows for the legacy api to be supported with `ztimer_usec` as
a drop-in replacement.
If `event_timeout` and `event_timeut_ztimer` are selected then
`event_timeout` SRC file is excluded from compilation.
Allow using `event_loop_multi()` to handle event queues of multiple priorities
in an single thread. In the extreme case, all three event queues are handled
by a single thread (thus saving two stacks). This comes for the price of
increased worst case latency, as already running event handlers will no longer
be preempted by higher priority events.
With this, all three event queue priorities are always provided. Using modules,
the old behavior of one thread per event queue can be restored for better worst
case latency at the expense of additional thread size.
When the expected ROM overhead of a function is bigger than the actual function,
it is better to provide the function as static inline function in the header.
The value of `queue->waiter` at the time the event was queued (with IRQs
disabled) was backed up to the stack-variable `waiter`. Thus, the test later on
for `waiter` checks if the queue was already claimed at the time the event
was queued. Therefore, there is no race.
Added `event_wait_multi()` that takes an array of event queues rather than
a single event queues. The queue with the lowest index will have the highest
priority.
With #10970 only existing *.c files will be added to SRC when using
the SUBMODULES mechanism, so SUBMODULES_NOFORCE (used to filter out
non existing source files) is now redundant so remove the usage.