callback.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Inria
3  * 2017 Freie Universität Berlin
4  * 2017 Kaspar Schleiser <kaspar@schleiser.de>
5  *
6  * This file is subject to the terms and conditions of the GNU Lesser
7  * General Public License v2.1. See the file LICENSE in the top level
8  * directory for more details.
9  */
10 
36 #ifndef EVENT_CALLBACK_H
37 #define EVENT_CALLBACK_H
38 
39 #include "event.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
48 typedef struct {
50  void (*callback)(void*);
51  void *arg;
53 
61 void event_callback_init(event_callback_t *event_callback, void (*callback)(void *), void *arg);
62 
71 
78 #define EVENT_CALLBACK_INIT(_cb, _arg) \
79  { \
80  .super.handler = _event_callback_handler, \
81  .callback = _cb, \
82  .arg = (void *)_arg \
83  }
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 #endif /* EVENT_CALLBACK_H */
89 
event_callback_t::super
event_t super
event_t structure that gets extended
Definition: callback.h:49
_event_callback_handler
void _event_callback_handler(event_t *event)
event callback handler function (used internally)
event
event structure
Definition: event.h:142
event_callback_t
Callback Event structure definition.
Definition: callback.h:48
event_callback_t::arg
void * arg
callback function argument
Definition: callback.h:51
event_callback_init
void event_callback_init(event_callback_t *event_callback, void(*callback)(void *), void *arg)
event callback initialization function