]> code.delx.au - pulseaudio/blobdiff - src/tests/asyncmsgq-test.c
tests: More useful output of make check
[pulseaudio] / src / tests / asyncmsgq-test.c
index d10b512dd6a2165f95d3f4a943e0fab3c8692a13..9fbe5bc8f89e30cbc41843f5a97b79c89a33fa8b 100644 (file)
@@ -1,11 +1,9 @@
-/* $Id$ */
-
 /***
   This file is part of PulseAudio.
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published
-  by the Free Software Foundation; either version 2 of the License,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
 #include <stdlib.h>
 #include <unistd.h>
 
-#include <pulse/util.h>
-#include <pulse/xmalloc.h>
 #include <pulsecore/asyncmsgq.h>
 #include <pulsecore/thread.h>
 #include <pulsecore/log.h>
-#include <pulsecore/core-util.h>
 #include <pulsecore/macro.h>
 
 enum {
@@ -49,29 +44,29 @@ static void the_thread(void *_q) {
     do {
         int code = 0;
 
-        pa_assert_se(pa_asyncmsgq_get(q, NULL, &code, NULL, 1) == 0);
+        pa_assert_se(pa_asyncmsgq_get(q, NULL, &code, NULL, NULL, NULL, 1) == 0);
 
         switch (code) {
 
             case OPERATION_A:
-                printf("Operation A\n");
+                pa_log_info("Operation A");
                 break;
 
             case OPERATION_B:
-                printf("Operation B\n");
+                pa_log_info("Operation B");
                 break;
 
             case OPERATION_C:
-                printf("Operation C\n");
+                pa_log_info("Operation C");
                 break;
 
             case QUIT:
-                printf("quit\n");
+                pa_log_info("quit");
                 quit = 1;
                 break;
         }
 
-        pa_asyncmsgq_done(q);
+        pa_asyncmsgq_done(q, 0);
 
     } while (!quit);
 }
@@ -82,29 +77,29 @@ int main(int argc, char *argv[]) {
 
     pa_assert_se(q = pa_asyncmsgq_new(0));
 
-    pa_assert_se(t = pa_thread_new(the_thread, q));
+    pa_assert_se(t = pa_thread_new("test", the_thread, q));
 
-    printf("Operation A post\n");
-    pa_asyncmsgq_post(q, NULL, OPERATION_A, NULL, NULL, NULL);
+    pa_log_info("Operation A post");
+    pa_asyncmsgq_post(q, NULL, OPERATION_A, NULL, 0, NULL, NULL);
 
     pa_thread_yield();
 
-    printf("Operation B post\n");
-    pa_asyncmsgq_post(q, NULL, OPERATION_B, NULL, NULL, NULL);
+    pa_log_info("Operation B post");
+    pa_asyncmsgq_post(q, NULL, OPERATION_B, NULL, 0, NULL, NULL);
 
     pa_thread_yield();
 
-    printf("Operation C send\n");
-    pa_asyncmsgq_send(q, NULL, OPERATION_C, NULL);
+    pa_log_info("Operation C send");
+    pa_asyncmsgq_send(q, NULL, OPERATION_C, NULL, 0, NULL);
 
     pa_thread_yield();
 
-    printf("Quit post\n");
-    pa_asyncmsgq_post(q, NULL, QUIT, NULL, NULL, NULL);
+    pa_log_info("Quit post");
+    pa_asyncmsgq_post(q, NULL, QUIT, NULL, 0, NULL, NULL);
 
     pa_thread_free(t);
 
-    pa_asyncmsgq_free(q);
+    pa_asyncmsgq_unref(q);
 
     return 0;
 }