]> code.delx.au - pulseaudio/blobdiff - src/tests/hook-list-test.c
alsa: work around slightly broken _delay implementations
[pulseaudio] / src / tests / hook-list-test.c
index d68d1b7d10a78da172acdb70ff9503aa901d48d7..452e47765da072be9f46c0dc209e68de6aa20d55 100644 (file)
@@ -1,14 +1,16 @@
-/* $Id$ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <pulsecore/hook-list.h>
 #include <pulsecore/log.h>
 
-static pa_hook_result_t func1(const char*hook_data, const char*call_data, const char*slot_data) {
+static pa_hook_result_t func1(const char *hook_data, const char *call_data, const char *slot_data) {
     pa_log("(func1) hook=%s call=%s slot=%s", hook_data, call_data, slot_data);
     return PA_HOOK_OK;
 }
 
-static pa_hook_result_t func2(const char*hook_data, const char*call_data, const char*slot_data) {
+static pa_hook_result_t func2(const char *hook_data, const char *call_data, const char *slot_data) {
     pa_log("(func2) hook=%s call=%s slot=%s", hook_data, call_data, slot_data);
     return PA_HOOK_OK;
 }
@@ -19,17 +21,17 @@ int main(int argc, char *argv[]) {
 
     pa_hook_init(&hook, (void*) "hook");
 
-    pa_hook_connect(&hook, (pa_hook_cb_t) func1, (void*) "slot1");
-    slot = pa_hook_connect(&hook, (pa_hook_cb_t) func2, (void*) "slot2");
-    pa_hook_connect(&hook, (pa_hook_cb_t) func1, (void*) "slot3");
-    
+    pa_hook_connect(&hook, PA_HOOK_LATE, (pa_hook_cb_t) func1, (void*) "slot1");
+    slot = pa_hook_connect(&hook, PA_HOOK_NORMAL, (pa_hook_cb_t) func2, (void*) "slot2");
+    pa_hook_connect(&hook, PA_HOOK_NORMAL, (pa_hook_cb_t) func1, (void*) "slot3");
+
     pa_hook_fire(&hook, (void*) "call1");
 
     pa_hook_slot_free(slot);
 
     pa_hook_fire(&hook, (void*) "call2");
 
-    pa_hook_free(&hook);
-    
+    pa_hook_done(&hook);
+
     return 0;
 }