]> code.delx.au - pulseaudio/blob - src/tests/hook-list-test.c
rework hook list stuff again, and replace macros with real functins. We loose type...
[pulseaudio] / src / tests / hook-list-test.c
1 /* $Id$ */
2
3 #include <pulsecore/hook-list.h>
4 #include <pulsecore/log.h>
5
6 static pa_hook_result_t func1(const char*a, void *userdata) {
7 pa_log("#1 arg=%s userdata=%s", a, (char*) userdata);
8 return PA_HOOK_OK;
9 }
10
11 static pa_hook_result_t func2(const char*a, void *userdata) {
12 pa_log("#2 arg=%s userdata=%s", a, (char*) userdata);
13 return PA_HOOK_OK;
14 }
15
16 int main(int argc, char *argv[]) {
17 pa_hook hook;
18 pa_hook_slot *slot;
19
20 pa_hook_init(&hook);
21
22 pa_hook_connect(&hook, (pa_hook_cb_t) func1, (void*) "1-1");
23 slot = pa_hook_connect(&hook, (pa_hook_cb_t) func2, (void*) "2-1");
24 pa_hook_connect(&hook, (pa_hook_cb_t) func1, (void*) "1-2");
25
26 pa_hook_fire(&hook, (void*) "arg2");
27
28 pa_hook_slot_free(slot);
29 pa_hook_free(&hook);
30
31 return 0;
32 }