-/* $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 {
do {
int code = 0;
- pa_assert_se(pa_asyncmsgq_get(q, NULL, &code, NULL, 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_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, 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;
}