diff --git a/sys/event/event.c b/sys/event/event.c index 570d7e232fd5bdec6be99d62e3d523a0950c3bf6..9e6ac213fe1e28515df12133cdceae44aa7164e2 100644 --- a/sys/event/event.c +++ b/sys/event/event.c @@ -23,11 +23,12 @@ void event_queue_init(event_queue_t *queue) void event_post(event_queue_t *queue, event_t *event) { - assert(!event->list_node.next); - assert(queue->waiter); + assert(queue && queue->waiter && event); unsigned state = irq_disable(); - clist_rpush(&queue->event_list, &event->list_node); + if (!event->list_node.next) { + clist_rpush(&queue->event_list, &event->list_node); + } irq_restore(state); thread_flags_set(queue->waiter, THREAD_FLAG_EVENT); diff --git a/sys/include/event.h b/sys/include/event.h index 7072de41e679efbfcace145ea793492960d47827..0727459c912e9669aa689434573d3e3e5ddb18a4 100644 --- a/sys/include/event.h +++ b/sys/include/event.h @@ -149,6 +149,11 @@ void event_queue_init(event_queue_t *queue); /** * @brief Queue an event * + * The given event will be posted on the given @p queue. If the event is already + * queued when calling this function, the event will not be touched and remain + * in the previous position on the queue. So reposting an event while it is + * already on the queue will have no effect. + * * @param[in] queue event queue to queue event in * @param[in] event event to queue in event queue */