mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
sys/event_callback: add event_callback_post()
This commit is contained in:
parent
18e6eaca00
commit
10f28b873e
@ -36,6 +36,7 @@
|
||||
#ifndef EVENT_CALLBACK_H
|
||||
#define EVENT_CALLBACK_H
|
||||
|
||||
#include <assert.h>
|
||||
#include "event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -60,6 +61,25 @@ typedef struct {
|
||||
*/
|
||||
void event_callback_init(event_callback_t *event_callback, void (*callback)(void *), void *arg);
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
* @pre queue should be initialized
|
||||
*
|
||||
* @param[in] queue event queue to queue event in
|
||||
* @param[in] event event to queue in event queue
|
||||
*/
|
||||
static inline void event_callback_post(event_queue_t *queue, event_callback_t *event)
|
||||
{
|
||||
assert(event->callback);
|
||||
event_post(queue, &event->super);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Generate a one-shot callback event on @p queue
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user