Skip to content

Commit

Permalink
Merge pull request RIOT-OS#20870 from derMihai/mir/event_timeout_zero
Browse files Browse the repository at this point in the history
event/timeout: event_timeout_set() enqueues immediately if timeout is zero
  • Loading branch information
benpicco authored Sep 25, 2024
2 parents 5c06502 + b7eee2c commit 7f959f8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sys/event/timeout_ztimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ void event_timeout_ztimer_init(event_timeout_t *event_timeout, ztimer_clock_t *c

void event_timeout_set(event_timeout_t *event_timeout, uint32_t timeout)
{
ztimer_set(event_timeout->clock, &event_timeout->timer, timeout);
if (timeout == 0) {
event_post(event_timeout->queue, event_timeout->event);
} else {
ztimer_set(event_timeout->clock, &event_timeout->timer, timeout);
}
}

void event_timeout_clear(event_timeout_t *event_timeout)
Expand Down

0 comments on commit 7f959f8

Please sign in to comment.