An event list library. Help for multi callback.
-
Header file (.h)
-
Define your callback function
typedef void (*event_callback) (void *data);
-
Define the event list prototype
EVENT_LIST_PROTO(NAME, event_callback)
-
Extern the Event List in header file (.h)
extern event_list_NAME_t el_test;
-
-
Source file (.c)
-
Define event list functions
EVENT_LIST_DEFINE(NAME)
-
Initialize event list
event_list_NAME_t el_test = EVENT_LIST_INIT("event list for test");
-
-
attach event handle.
el_NAME_attach(&el_test, my_callback, NULL);
my_callback
is an user-defined callback function -
fire the event
- if the callback function has extra arguments
EVENT_LIST_FIRE(&el_test, ARG1, ARG2);
- if there is no extra argument in callback function
EVENT_LIST_CALL(&el_test);
iXuan [email protected]
MIT