From b7eee2c8b7a257b48a79d6fd2f16fd0897212549 Mon Sep 17 00:00:00 2001 From: Mihai Renea Date: Wed, 25 Sep 2024 10:00:58 +0200 Subject: [PATCH] event/timeout: event_timeout_set() enqueues immediately if timeout is zero --- sys/event/timeout_ztimer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/event/timeout_ztimer.c b/sys/event/timeout_ztimer.c index 84fd34d9b3..12d37e326f 100644 --- a/sys/event/timeout_ztimer.c +++ b/sys/event/timeout_ztimer.c @@ -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)