4 This file is part of PulseAudio.
6 PulseAudio is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published
8 by the Free Software Foundation; either version 2 of the License,
9 or (at your option) any later version.
11 PulseAudio is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with PulseAudio; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
30 #include <pulse/util.h>
31 #include <pulse/xmalloc.h>
32 #include <pulsecore/asyncmsgq.h>
33 #include <pulsecore/thread.h>
34 #include <pulsecore/log.h>
35 #include <pulsecore/core-util.h>
36 #include <pulsecore/macro.h>
45 static void the_thread(void *_q) {
52 pa_assert_se(pa_asyncmsgq_get(q, NULL, &code, NULL, NULL, NULL, 1) == 0);
57 printf("Operation A\n");
61 printf("Operation B\n");
65 printf("Operation C\n");
74 pa_asyncmsgq_done(q, 0);
79 int main(int argc, char *argv[]) {
83 pa_assert_se(q = pa_asyncmsgq_new(0));
85 pa_assert_se(t = pa_thread_new(the_thread, q));
87 printf("Operation A post\n");
88 pa_asyncmsgq_post(q, NULL, OPERATION_A, NULL, 0, NULL, NULL);
92 printf("Operation B post\n");
93 pa_asyncmsgq_post(q, NULL, OPERATION_B, NULL, 0, NULL, NULL);
97 printf("Operation C send\n");
98 pa_asyncmsgq_send(q, NULL, OPERATION_C, NULL, 0, NULL);
102 printf("Quit post\n");
103 pa_asyncmsgq_post(q, NULL, QUIT, NULL, 0, NULL, NULL);
107 pa_asyncmsgq_free(q);