3 #include <pulsecore/hook-list.h>
4 #include <pulsecore/log.h>
6 static pa_hook_result_t
func1(const char*hook_data
, const char*call_data
, const char*slot_data
) {
7 pa_log("(func1) hook=%s call=%s slot=%s", hook_data
, call_data
, slot_data
);
11 static pa_hook_result_t
func2(const char*hook_data
, const char*call_data
, const char*slot_data
) {
12 pa_log("(func2) hook=%s call=%s slot=%s", hook_data
, call_data
, slot_data
);
16 int main(int argc
, char *argv
[]) {
20 pa_hook_init(&hook
, (void*) "hook");
22 pa_hook_connect(&hook
, (pa_hook_cb_t
) func1
, (void*) "slot1");
23 slot
= pa_hook_connect(&hook
, (pa_hook_cb_t
) func2
, (void*) "slot2");
24 pa_hook_connect(&hook
, (pa_hook_cb_t
) func1
, (void*) "slot3");
26 pa_hook_fire(&hook
, (void*) "call1");
28 pa_hook_slot_free(slot
);
30 pa_hook_fire(&hook
, (void*) "call2");