callback.h File Reference

Provides a callback-with-argument event type. More...

Detailed Description

Provides a callback-with-argument event type.

Example:

void callback(void *arg)
{
printf("%s called with arg %p\n", __func__, arg);
}
[...]
event_callback_t event_callback = EVENT_CALLBACK_INIT(callback, 0x12345678);
event_post(&queue, &event_callback);

Event Callback API

Author
Kaspar Schleiser kaspa.nosp@m.r@sc.nosp@m.hleis.nosp@m.er.d.nosp@m.e

Definition in file callback.h.

#include "event.h"
+ Include dependency graph for callback.h:

Go to the source code of this file.

Data Structures

struct  event_callback_t
 Callback Event structure definition. More...
 
#define EVENT_CALLBACK_INIT(_cb, _arg)
 Callback Event static initializer. More...
 
void event_callback_init (event_callback_t *event_callback, void(*callback)(void *), void *arg)
 event callback initialization function More...
 
void _event_callback_handler (event_t *event)
 event callback handler function (used internally)
 

Macro Definition Documentation

◆ EVENT_CALLBACK_INIT

#define EVENT_CALLBACK_INIT (   _cb,
  _arg 
)
Value:
{ \
.super.handler = _event_callback_handler, \
.callback = _cb, \
.arg = (void *)_arg \
}
void _event_callback_handler(event_t *event)
event callback handler function (used internally)

Callback Event static initializer.

Parameters
[in]_cbcallback function to set
[in]_argarguments to set

Definition at line 76 of file callback.h.

Function Documentation

◆ event_callback_init()

void event_callback_init ( event_callback_t event_callback,
void(*)(void *)  callback,
void *  arg 
)

event callback initialization function

Parameters
[out]event_callbackobject to initialize
[in]callbackcallback to set up
[in]argcallback argument to set up