[pulseaudio-commits] r1624 - in /branches/lennart/src: modules/ pulsecore/

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Fri Aug 10 15:02:40 PDT 2007


Author: lennart
Date: Sat Aug 11 00:02:39 2007
New Revision: 1624

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1624&root=3Dpulseaudio&vi=
ew=3Drev
Log:
make use of pa_thread_mq everywhere

Modified:
    branches/lennart/src/modules/module-alsa-sink.c
    branches/lennart/src/modules/module-alsa-source.c
    branches/lennart/src/modules/module-null-sink.c
    branches/lennart/src/modules/module-oss.c
    branches/lennart/src/modules/module-pipe-sink.c
    branches/lennart/src/modules/module-pipe-source.c
    branches/lennart/src/pulsecore/core.c
    branches/lennart/src/pulsecore/core.h
    branches/lennart/src/pulsecore/play-memchunk.c
    branches/lennart/src/pulsecore/protocol-esound.c
    branches/lennart/src/pulsecore/protocol-native.c
    branches/lennart/src/pulsecore/protocol-simple.c
    branches/lennart/src/pulsecore/sound-file-stream.c

Modified: branches/lennart/src/modules/module-alsa-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-alsa-sink.c?rev=3D1624&root=3Dpulseaudio&r1=3D1623&r2=3D1624&view=3Ddi=
ff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-alsa-sink.c (original)
+++ branches/lennart/src/modules/module-alsa-sink.c Sat Aug 11 00:02:39 2007
@@ -50,6 +50,7 @@
 #include <pulsecore/macro.h>
 #include <pulsecore/thread.h>
 #include <pulsecore/core-error.h>
+#include <pulsecore/thread-mq.h>
 =

 #include "alsa-util.h"
 #include "module-alsa-sink-symdef.h"
@@ -78,7 +79,7 @@
     pa_module *module;
     pa_sink *sink;
     pa_thread *thread;
-    pa_asyncmsgq *asyncmsgq;
+    pa_thread_mq thread_mq;
     =

     snd_pcm_t *pcm_handle;
 =

@@ -254,7 +255,7 @@
     pa_xfree(u->pollfd);
     u->pollfd =3D pa_xnew0(struct pollfd, POLLFD_ALSA_BASE + u->n_alsa_fds=
);
 =

-    u->pollfd[POLLFD_ASYNCQ].fd =3D pa_asyncmsgq_get_fd(u->asyncmsgq);
+    u->pollfd[POLLFD_ASYNCQ].fd =3D pa_asyncmsgq_get_fd(u->thread_mq.inq);
     u->pollfd[POLLFD_ASYNCQ].events =3D POLLIN;
 =

     if ((err =3D snd_pcm_poll_descriptors(u->pcm_handle, u->pollfd+POLLFD_=
ALSA_BASE, u->n_alsa_fds)) < 0) {
@@ -528,6 +529,8 @@
 =

     pa_log_debug("Thread starting up");
 =

+    pa_thread_mq_install(&u->thread_mq);
+    =

     if (build_pollfd(u) < 0)
         goto fail;
 =

@@ -542,18 +545,18 @@
 /*         pa_log("loop");      */
         =

         /* Check whether there is a message for us to process */
-        if (pa_asyncmsgq_get(u->asyncmsgq, &object, &code, &data, &offset,=
 &chunk, 0) =3D=3D 0) {
+        if (pa_asyncmsgq_get(u->thread_mq.inq, &object, &code, &data, &off=
set, &chunk, 0) =3D=3D 0) {
             int ret;
 =

 /*             pa_log("processing msg");  */
 =

             if (!object && code =3D=3D PA_MESSAGE_SHUTDOWN) {
-                pa_asyncmsgq_done(u->asyncmsgq, 0);
+                pa_asyncmsgq_done(u->thread_mq.inq, 0);
                 goto finish;
             }
 =

             ret =3D pa_asyncmsgq_dispatch(object, code, data, offset, &chu=
nk);
-            pa_asyncmsgq_done(u->asyncmsgq, ret);
+            pa_asyncmsgq_done(u->thread_mq.inq, ret);
             continue;
         } =

 =

@@ -649,14 +652,14 @@
         }
 =

         /* Hmm, nothing to do. Let's sleep */
-        if (pa_asyncmsgq_before_poll(u->asyncmsgq) < 0)
+        if (pa_asyncmsgq_before_poll(u->thread_mq.inq) < 0)
             continue;
 =

 /*         pa_log("polling for %i", POLLFD_ALSA_BASE + (PA_SINK_OPENED(u->=
sink->thread_info.state) ? u->n_alsa_fds : 0));    */
         r =3D poll(u->pollfd, POLLFD_ALSA_BASE + (PA_SINK_OPENED(u->sink->=
thread_info.state) ? u->n_alsa_fds : 0), -1);
 /*         pa_log("poll end"); */
 =

-        pa_asyncmsgq_after_poll(u->asyncmsgq);
+        pa_asyncmsgq_after_poll(u->thread_mq.inq);
 =

         if (r < 0) {
             if (errno =3D=3D EINTR) {
@@ -697,8 +700,8 @@
 fail:
     /* We have to continue processing messages until we receive the
      * SHUTDOWN message */
-    pa_asyncmsgq_post(u->core->asyncmsgq, PA_MSGOBJECT(u->core), PA_CORE_M=
ESSAGE_UNLOAD_MODULE, u->module, 0, NULL, NULL);
-    pa_asyncmsgq_wait_for(u->asyncmsgq, PA_MESSAGE_SHUTDOWN);
+    pa_asyncmsgq_post(u->thread_mq.outq, PA_MSGOBJECT(u->core), PA_CORE_ME=
SSAGE_UNLOAD_MODULE, u->module, 0, NULL, NULL);
+    pa_asyncmsgq_wait_for(u->thread_mq.inq, PA_MESSAGE_SHUTDOWN);
 =

 finish:
     pa_log_debug("Thread shutting down");
@@ -762,7 +765,7 @@
     u->first =3D 1;
     u->n_alsa_fds =3D 0;
     u->pollfd =3D NULL;
-    pa_assert_se(u->asyncmsgq =3D pa_asyncmsgq_new(0));
+    pa_thread_mq_init(&u->thread_mq, m->core->mainloop);
 =

     snd_config_update_free_global();
     if ((err =3D snd_pcm_open(&u->pcm_handle, dev =3D pa_modargs_get_value=
(ma, "device", DEFAULT_DEVICE), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK))=
 < 0) {
@@ -835,7 +838,7 @@
     u->sink->userdata =3D u;
 =

     pa_sink_set_module(u->sink, m);
-    pa_sink_set_asyncmsgq(u->sink, u->asyncmsgq);
+    pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
     pa_sink_set_description(u->sink, t =3D pa_sprintf_malloc(
                                     "ALSA PCM on %s (%s)",
                                     dev,
@@ -933,13 +936,12 @@
         pa_sink_disconnect(u->sink);
 =

     if (u->thread) {
-        pa_asyncmsgq_send(u->asyncmsgq, NULL, PA_MESSAGE_SHUTDOWN, NULL, 0=
, NULL);
+        pa_asyncmsgq_send(u->thread_mq.inq, NULL, PA_MESSAGE_SHUTDOWN, NUL=
L, 0, NULL);
         pa_thread_free(u->thread);
     }
 =

-    if (u->asyncmsgq)
-        pa_asyncmsgq_free(u->asyncmsgq);
-
+    pa_thread_mq_done(&u->thread_mq);
+    =

     if (u->sink)
         pa_sink_unref(u->sink);
     =


Modified: branches/lennart/src/modules/module-alsa-source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-alsa-source.c?rev=3D1624&root=3Dpulseaudio&r1=3D1623&r2=3D1624&view=3D=
diff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-alsa-source.c (original)
+++ branches/lennart/src/modules/module-alsa-source.c Sat Aug 11 00:02:39 2=
007
@@ -51,6 +51,7 @@
 #include <pulsecore/macro.h>
 #include <pulsecore/thread.h>
 #include <pulsecore/core-error.h>
+#include <pulsecore/thread-mq.h>
 =

 #include "alsa-util.h"
 #include "module-alsa-source-symdef.h"
@@ -78,7 +79,7 @@
     pa_module *module;
     pa_source *source;
     pa_thread *thread;
-    pa_asyncmsgq *asyncmsgq;
+    pa_thread_mq thread_mq;
 =

     snd_pcm_t *pcm_handle;
 =

@@ -242,7 +243,7 @@
     pa_xfree(u->pollfd);
     u->pollfd =3D pa_xnew0(struct pollfd, POLLFD_ALSA_BASE + u->n_alsa_fds=
);
 =

-    u->pollfd[POLLFD_ASYNCQ].fd =3D pa_asyncmsgq_get_fd(u->asyncmsgq);
+    u->pollfd[POLLFD_ASYNCQ].fd =3D pa_asyncmsgq_get_fd(u->thread_mq.inq);
     u->pollfd[POLLFD_ASYNCQ].events =3D POLLIN;
 =

     if ((err =3D snd_pcm_poll_descriptors(u->pcm_handle, u->pollfd+POLLFD_=
ALSA_BASE, u->n_alsa_fds)) < 0) {
@@ -516,6 +517,8 @@
 =

     pa_log_debug("Thread starting up");
 =

+    pa_thread_mq_install(&u->thread_mq);
+    =

     if (build_pollfd(u) < 0)
         goto fail;
 =

@@ -530,18 +533,18 @@
 /*         pa_log("loop");     */
         =

         /* Check whether there is a message for us to process */
-        if (pa_asyncmsgq_get(u->asyncmsgq, &object, &code, &data, &offset,=
 &chunk, 0) =3D=3D 0) {
+        if (pa_asyncmsgq_get(u->thread_mq.inq, &object, &code, &data, &off=
set, &chunk, 0) =3D=3D 0) {
             int ret;
 =

 /*             pa_log("processing msg"); */
 =

             if (!object && code =3D=3D PA_MESSAGE_SHUTDOWN) {
-                pa_asyncmsgq_done(u->asyncmsgq, 0);
+                pa_asyncmsgq_done(u->thread_mq.inq, 0);
                 goto finish;
             }
 =

             ret =3D pa_asyncmsgq_dispatch(object, code, data, offset, &chu=
nk);
-            pa_asyncmsgq_done(u->asyncmsgq, ret);
+            pa_asyncmsgq_done(u->thread_mq.inq, ret);
             continue;
         } =

 =

@@ -624,14 +627,14 @@
         }
 =

         /* Hmm, nothing to do. Let's sleep */
-        if (pa_asyncmsgq_before_poll(u->asyncmsgq) < 0)
+        if (pa_asyncmsgq_before_poll(u->thread_mq.inq) < 0)
             continue;
 =

 /*         pa_log("polling for %i", POLLFD_ALSA_BASE + (PA_SOURCE_OPENED(u=
->source->thread_info.state) ? n_alsa_fds : 0));   */
         r =3D poll(u->pollfd, POLLFD_ALSA_BASE + (PA_SOURCE_OPENED(u->sour=
ce->thread_info.state) ? u->n_alsa_fds : 0), -1);
 /*         pa_log("poll end"); */
 =

-        pa_asyncmsgq_after_poll(u->asyncmsgq);
+        pa_asyncmsgq_after_poll(u->thread_mq.inq);
 =

         if (r < 0) {
             if (errno =3D=3D EINTR) {
@@ -672,8 +675,8 @@
 fail:
     /* We have to continue processing messages until we receive the
      * SHUTDOWN message */
-    pa_asyncmsgq_post(u->core->asyncmsgq, PA_MSGOBJECT(u->core), PA_CORE_M=
ESSAGE_UNLOAD_MODULE, u->module, 0, NULL, NULL);
-    pa_asyncmsgq_wait_for(u->asyncmsgq, PA_MESSAGE_SHUTDOWN);
+    pa_asyncmsgq_post(u->thread_mq.outq, PA_MSGOBJECT(u->core), PA_CORE_ME=
SSAGE_UNLOAD_MODULE, u->module, 0, NULL, NULL);
+    pa_asyncmsgq_wait_for(u->thread_mq.inq, PA_MESSAGE_SHUTDOWN);
 =

 finish:
     pa_log_debug("Thread shutting down");
@@ -735,7 +738,9 @@
     u->module =3D m;
     m->userdata =3D u;
     u->use_mmap =3D use_mmap;
-    pa_assert_se(u->asyncmsgq =3D pa_asyncmsgq_new(0));
+    u->n_alsa_fds =3D 0;
+    u->pollfd =3D NULL;
+    pa_thread_mq_init(&u->thread_mq, m->core->mainloop);
 =

     snd_config_update_free_global();
     if ((err =3D snd_pcm_open(&u->pcm_handle, dev =3D pa_modargs_get_value=
(ma, "device", DEFAULT_DEVICE), SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK)) =
< 0) {
@@ -807,7 +812,7 @@
     u->source->userdata =3D u;
 =

     pa_source_set_module(u->source, m);
-    pa_source_set_asyncmsgq(u->source, u->asyncmsgq);
+    pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
     pa_source_set_description(u->source, t =3D pa_sprintf_malloc(
                                       "ALSA PCM on %s (%s)",
                                       dev,
@@ -902,12 +907,11 @@
         pa_source_disconnect(u->source);
 =

     if (u->thread) {
-        pa_asyncmsgq_send(u->asyncmsgq, NULL, PA_MESSAGE_SHUTDOWN, NULL, 0=
, NULL);
+        pa_asyncmsgq_send(u->thread_mq.inq, NULL, PA_MESSAGE_SHUTDOWN, NUL=
L, 0, NULL);
         pa_thread_free(u->thread);
     }
 =

-    if (u->asyncmsgq)
-        pa_asyncmsgq_free(u->asyncmsgq);
+    pa_thread_mq_done(&u->thread_mq);
 =

     if (u->source)
         pa_source_unref(u->source);

Modified: branches/lennart/src/modules/module-null-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-null-sink.c?rev=3D1624&root=3Dpulseaudio&r1=3D1623&r2=3D1624&view=3Ddi=
ff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-null-sink.c (original)
+++ branches/lennart/src/modules/module-null-sink.c Sat Aug 11 00:02:39 2007
@@ -46,6 +46,7 @@
 #include <pulsecore/modargs.h>
 #include <pulsecore/log.h>
 #include <pulsecore/thread.h>
+#include <pulsecore/thread-mq.h>
 =

 #include "module-null-sink-symdef.h"
 =

@@ -67,7 +68,7 @@
     pa_module *module;
     pa_sink *sink;
     pa_thread *thread;
-    pa_asyncmsgq *asyncmsgq;
+    pa_thread_mq thread_mq;
     size_t block_size;
     =

     struct timeval timestamp;
@@ -118,10 +119,12 @@
 =

     pa_log_debug("Thread starting up");
 =

+    pa_thread_mq_install(&u->thread_mq);
+
     pa_gettimeofday(&u->timestamp);
 =

     memset(&pollfd, 0, sizeof(pollfd));
-    pollfd.fd =3D pa_asyncmsgq_get_fd(u->asyncmsgq);
+    pollfd.fd =3D pa_asyncmsgq_get_fd(u->thread_mq.inq);
     pollfd.events =3D POLLIN;
 =

     for (;;) {
@@ -134,16 +137,16 @@
         int64_t offset;
 =

         /* Check whether there is a message for us to process */
-        if (pa_asyncmsgq_get(u->asyncmsgq, &object, &code, &data, &offset,=
 &chunk, 0) =3D=3D 0) {
+        if (pa_asyncmsgq_get(u->thread_mq.inq, &object, &code, &data, &off=
set, &chunk, 0) =3D=3D 0) {
             int ret;
 =

             if (!object && code =3D=3D PA_MESSAGE_SHUTDOWN) {
-                pa_asyncmsgq_done(u->asyncmsgq, 0);
+                pa_asyncmsgq_done(u->thread_mq.inq, 0);
                 goto finish;
             }
 =

             ret =3D pa_asyncmsgq_dispatch(object, code, data, offset, &chu=
nk);
-            pa_asyncmsgq_done(u->asyncmsgq, ret);
+            pa_asyncmsgq_done(u->thread_mq.inq, ret);
             continue;
         }
 =

@@ -169,11 +172,11 @@
 =

         /* Hmm, nothing to do. Let's sleep */
 =

-        if (pa_asyncmsgq_before_poll(u->asyncmsgq) < 0)
+        if (pa_asyncmsgq_before_poll(u->thread_mq.inq) < 0)
             continue;
 =

         r =3D poll(&pollfd, 1, timeout);
-        pa_asyncmsgq_after_poll(u->asyncmsgq);
+        pa_asyncmsgq_after_poll(u->thread_mq.inq);
 =

         if (r < 0) {
             if (errno =3D=3D EINTR) {
@@ -191,8 +194,8 @@
 fail:
     /* We have to continue processing messages until we receive the
      * SHUTDOWN message */
-    pa_asyncmsgq_post(u->core->asyncmsgq, PA_MSGOBJECT(u->core), PA_CORE_M=
ESSAGE_UNLOAD_MODULE, u->module, 0, NULL, NULL);
-    pa_asyncmsgq_wait_for(u->asyncmsgq, PA_MESSAGE_SHUTDOWN);
+    pa_asyncmsgq_post(u->thread_mq.outq, PA_MSGOBJECT(u->core), PA_CORE_ME=
SSAGE_UNLOAD_MODULE, u->module, 0, NULL, NULL);
+    pa_asyncmsgq_wait_for(u->thread_mq.inq, PA_MESSAGE_SHUTDOWN);
 =

 finish:
     pa_log_debug("Thread shutting down");
@@ -222,7 +225,7 @@
     u->module =3D m;
     m->userdata =3D u;
 =

-    pa_assert_se(u->asyncmsgq =3D pa_asyncmsgq_new(0));
+    pa_thread_mq_init(&u->thread_mq, m->core->mainloop);
     =

     if (!(u->sink =3D pa_sink_new(m->core, __FILE__, pa_modargs_get_value(=
ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
         pa_log("Failed to create sink.");
@@ -233,7 +236,7 @@
     u->sink->userdata =3D u;
 =

     pa_sink_set_module(u->sink, m);
-    pa_sink_set_asyncmsgq(u->sink, u->asyncmsgq);
+    pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
     pa_sink_set_description(u->sink, pa_modargs_get_value(ma, "description=
", "NULL sink"));
 =

     u->block_size =3D pa_bytes_per_second(&ss) / 20; /* 50 ms */
@@ -270,12 +273,11 @@
         pa_sink_disconnect(u->sink);
 =

     if (u->thread) {
-        pa_asyncmsgq_send(u->asyncmsgq, NULL, PA_MESSAGE_SHUTDOWN, NULL, 0=
, NULL);
+        pa_asyncmsgq_send(u->thread_mq.inq, NULL, PA_MESSAGE_SHUTDOWN, NUL=
L, 0, NULL);
         pa_thread_free(u->thread);
     }
 =

-    if (u->asyncmsgq)
-        pa_asyncmsgq_free(u->asyncmsgq);
+    pa_thread_mq_done(&u->thread_mq);
 =

     if (u->sink)
         pa_sink_unref(u->sink);

Modified: branches/lennart/src/modules/module-oss.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-oss.c?rev=3D1624&root=3Dpulseaudio&r1=3D1623&r2=3D1624&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-oss.c (original)
+++ branches/lennart/src/modules/module-oss.c Sat Aug 11 00:02:39 2007
@@ -79,6 +79,7 @@
 #include <pulsecore/modargs.h>
 #include <pulsecore/log.h>
 #include <pulsecore/macro.h>
+#include <pulsecore/thread-mq.h>
 =

 #include "oss-util.h"
 #include "module-oss-symdef.h"
@@ -111,7 +112,7 @@
     pa_sink *sink;
     pa_source *source;
     pa_thread *thread;
-    pa_asyncmsgq *asyncmsgq;
+    pa_thread_mq thread_mq;
 =

     char *device_name;
     =

@@ -793,11 +794,13 @@
 =

     pa_log_debug("Thread starting up");
 =

+    pa_thread_mq_install(&u->thread_mq);
+
     trigger(u, 0);
     =

     memset(&pollfd, 0, sizeof(pollfd));
 =

-    pollfd[POLLFD_ASYNCQ].fd =3D pa_asyncmsgq_get_fd(u->asyncmsgq);
+    pollfd[POLLFD_ASYNCQ].fd =3D pa_asyncmsgq_get_fd(u->thread_mq.inq);
     pollfd[POLLFD_ASYNCQ].events =3D POLLIN;
     pollfd[POLLFD_DSP].fd =3D u->fd;
 =

@@ -812,18 +815,18 @@
 /*        pa_log("loop");    */
         =

         /* Check whether there is a message for us to process */
-        if (pa_asyncmsgq_get(u->asyncmsgq, &object, &code, &data, &offset,=
 &chunk, 0) =3D=3D 0) {
+        if (pa_asyncmsgq_get(u->thread_mq.inq, &object, &code, &data, &off=
set, &chunk, 0) =3D=3D 0) {
             int ret;
 =

 /*             pa_log("processing msg"); */
 =

             if (!object && code =3D=3D PA_MESSAGE_SHUTDOWN) {
-                pa_asyncmsgq_done(u->asyncmsgq, 0);
+                pa_asyncmsgq_done(u->thread_mq.inq, 0);
                 goto finish;
             }
 =

             ret =3D pa_asyncmsgq_dispatch(object, code, data, offset, &chu=
nk);
-            pa_asyncmsgq_done(u->asyncmsgq, ret);
+            pa_asyncmsgq_done(u->thread_mq.inq, ret);
             continue;
         } =

 =

@@ -1016,14 +1019,14 @@
             =

         /* Hmm, nothing to do. Let's sleep */
 =

-        if (pa_asyncmsgq_before_poll(u->asyncmsgq) < 0)
+        if (pa_asyncmsgq_before_poll(u->thread_mq.inq) < 0)
             continue;
 =

 /*         pa_log("polling for %i (legend: %i=3DPOLLIN, %i=3DPOLLOUT)", u-=
>fd >=3D 0 ? pollfd[POLLFD_DSP].events : -1, POLLIN, POLLOUT); */
         r =3D poll(pollfd, u->fd >=3D 0 ? POLLFD_MAX : POLLFD_DSP, -1);
 /*         pa_log("polling got dsp=3D%i amq=3D%i (%i)", r > 0 ? pollfd[POL=
LFD_DSP].revents : 0, r > 0 ? pollfd[POLLFD_ASYNCQ].revents : 0, r); */
 =

-        pa_asyncmsgq_after_poll(u->asyncmsgq);
+        pa_asyncmsgq_after_poll(u->thread_mq.inq);
 =

         if (u->fd < 0)
             pollfd[POLLFD_DSP].revents =3D 0;
@@ -1052,8 +1055,8 @@
 fail:
     /* We have to continue processing messages until we receive the
      * SHUTDOWN message */
-    pa_asyncmsgq_post(u->core->asyncmsgq, PA_MSGOBJECT(u->core), PA_CORE_M=
ESSAGE_UNLOAD_MODULE, u->module, 0, NULL, NULL);
-    pa_asyncmsgq_wait_for(u->asyncmsgq, PA_MESSAGE_SHUTDOWN);
+    pa_asyncmsgq_post(u->thread_mq.outq, PA_MSGOBJECT(u->core), PA_CORE_ME=
SSAGE_UNLOAD_MODULE, u->module, 0, NULL, NULL);
+    pa_asyncmsgq_wait_for(u->thread_mq.inq, PA_MESSAGE_SHUTDOWN);
 =

 finish:
     pa_log_debug("Thread shutting down");
@@ -1161,7 +1164,7 @@
     u->in_nfrags =3D u->out_nfrags =3D u->nfrags =3D nfrags;
     u->out_fragment_size =3D u->in_fragment_size =3D u->frag_size =3D frag=
_size;
     u->use_mmap =3D use_mmap;
-    pa_assert_se(u->asyncmsgq =3D pa_asyncmsgq_new(0));
+    pa_thread_mq_init(&u->thread_mq, m->core->mainloop);
 =

     if (ioctl(fd, SNDCTL_DSP_GETISPACE, &info) >=3D 0) {
         pa_log_info("Input -- %u fragments of size %u.", info.fragstotal, =
info.fragsize);
@@ -1216,7 +1219,7 @@
         u->source->userdata =3D u;
 =

         pa_source_set_module(u->source, m);
-        pa_source_set_asyncmsgq(u->source, u->asyncmsgq);
+        pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
         pa_source_set_description(u->source, t =3D pa_sprintf_malloc(
                                           "OSS PCM on %s%s%s%s",
                                           dev,
@@ -1270,7 +1273,7 @@
         u->sink->userdata =3D u;
         =

         pa_sink_set_module(u->sink, m);
-        pa_sink_set_asyncmsgq(u->sink, u->asyncmsgq);
+        pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
         pa_sink_set_description(u->sink, t =3D pa_sprintf_malloc(
                                         "OSS PCM on %s%s%s%s",
                                         dev,
@@ -1300,9 +1303,9 @@
 =

     /* Read mixer settings */
     if (u->source)
-        pa_asyncmsgq_post(u->asyncmsgq, PA_MSGOBJECT(u->source), PA_SOURCE=
_MESSAGE_GET_VOLUME, &u->source->volume, 0, NULL, NULL);
+        pa_asyncmsgq_post(u->thread_mq.inq, PA_MSGOBJECT(u->source), PA_SO=
URCE_MESSAGE_GET_VOLUME, &u->source->volume, 0, NULL, NULL);
     if (u->sink)
-        pa_asyncmsgq_post(u->asyncmsgq, PA_MSGOBJECT(u->sink), PA_SINK_MES=
SAGE_GET_VOLUME, &u->sink->volume, 0, NULL, NULL);
+        pa_asyncmsgq_post(u->thread_mq.inq, PA_MSGOBJECT(u->sink), PA_SINK=
_MESSAGE_GET_VOLUME, &u->sink->volume, 0, NULL, NULL);
 =

     return 0;
 =

@@ -1334,12 +1337,11 @@
         pa_source_disconnect(u->source);
 =

     if (u->thread) {
-        pa_asyncmsgq_send(u->asyncmsgq, NULL, PA_MESSAGE_SHUTDOWN, NULL, 0=
, NULL);
+        pa_asyncmsgq_send(u->thread_mq.inq, NULL, PA_MESSAGE_SHUTDOWN, NUL=
L, 0, NULL);
         pa_thread_free(u->thread);
     }
 =

-    if (u->asyncmsgq)
-        pa_asyncmsgq_free(u->asyncmsgq);
+    pa_thread_mq_done(&u->thread_mq);
 =

     if (u->sink)
         pa_sink_unref(u->sink);

Modified: branches/lennart/src/modules/module-pipe-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-pipe-sink.c?rev=3D1624&root=3Dpulseaudio&r1=3D1623&r2=3D1624&view=3Ddi=
ff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-pipe-sink.c (original)
+++ branches/lennart/src/modules/module-pipe-sink.c Sat Aug 11 00:02:39 2007
@@ -45,6 +45,7 @@
 #include <pulsecore/modargs.h>
 #include <pulsecore/log.h>
 #include <pulsecore/thread.h>
+#include <pulsecore/thread-mq.h>
 =

 #include "module-pipe-sink-symdef.h"
 =

@@ -67,7 +68,7 @@
     pa_module *module;
     pa_sink *sink;
     pa_thread *thread;
-    pa_asyncmsgq *asyncmsgq;
+    pa_thread_mq thread_mq;
     char *filename;
     int fd;
 =

@@ -121,9 +122,11 @@
 =

     pa_log_debug("Thread starting up");
 =

+    pa_thread_mq_install(&u->thread_mq);
+
     memset(&pollfd, 0, sizeof(pollfd));
     =

-    pollfd[POLLFD_ASYNCQ].fd =3D pa_asyncmsgq_get_fd(u->asyncmsgq);
+    pollfd[POLLFD_ASYNCQ].fd =3D pa_asyncmsgq_get_fd(u->thread_mq.inq);
     pollfd[POLLFD_ASYNCQ].events =3D POLLIN;
     pollfd[POLLFD_FIFO].fd =3D u->fd;
 =

@@ -136,16 +139,16 @@
         int64_t offset;
 =

         /* Check whether there is a message for us to process */
-        if (pa_asyncmsgq_get(u->asyncmsgq, &object, &code, &data, &offset,=
 &chunk, 0) =3D=3D 0) {
+        if (pa_asyncmsgq_get(u->thread_mq.inq, &object, &code, &data, &off=
set, &chunk, 0) =3D=3D 0) {
             int ret;
 =

             if (!object && code =3D=3D PA_MESSAGE_SHUTDOWN) {
-                pa_asyncmsgq_done(u->asyncmsgq, 0);
+                pa_asyncmsgq_done(u->thread_mq.inq, 0);
                 goto finish;
             }
 =

             ret =3D pa_asyncmsgq_dispatch(object, code, data, offset, &chu=
nk);
-            pa_asyncmsgq_done(u->asyncmsgq, ret);
+            pa_asyncmsgq_done(u->thread_mq.inq, ret);
             continue;
         }
 =

@@ -194,14 +197,14 @@
 =

         /* Hmm, nothing to do. Let's sleep */
 =

-        if (pa_asyncmsgq_before_poll(u->asyncmsgq) < 0)
+        if (pa_asyncmsgq_before_poll(u->thread_mq.inq) < 0)
             continue;
 =

 /*         pa_log("polling for %u", pollfd[POLLFD_FIFO].events);  */
         r =3D poll(pollfd, POLLFD_MAX, -1);
 /*         pa_log("polling got %u", r > 0 ? pollfd[POLLFD_FIFO].revents : =
0);  */
 =

-        pa_asyncmsgq_after_poll(u->asyncmsgq);
+        pa_asyncmsgq_after_poll(u->thread_mq.inq);
 =

         if (r < 0) {
             if (errno =3D=3D EINTR) {
@@ -225,8 +228,8 @@
 fail:
     /* We have to continue processing messages until we receive the
      * SHUTDOWN message */
-    pa_asyncmsgq_post(u->core->asyncmsgq, PA_MSGOBJECT(u->core), PA_CORE_M=
ESSAGE_UNLOAD_MODULE, u->module, 0, NULL, NULL);
-    pa_asyncmsgq_wait_for(u->asyncmsgq, PA_MESSAGE_SHUTDOWN);
+    pa_asyncmsgq_post(u->thread_mq.outq, PA_MSGOBJECT(u->core), PA_CORE_ME=
SSAGE_UNLOAD_MODULE, u->module, 0, NULL, NULL);
+    pa_asyncmsgq_wait_for(u->thread_mq.inq, PA_MESSAGE_SHUTDOWN);
 =

 finish:
     pa_log_debug("Thread shutting down");
@@ -258,8 +261,7 @@
     u->module =3D m;
     m->userdata =3D u;
     pa_memchunk_reset(&u->memchunk);
-
-    pa_assert_se(u->asyncmsgq =3D pa_asyncmsgq_new(0));
+    pa_thread_mq_init(&u->thread_mq, m->core->mainloop);
     =

     u->filename =3D pa_xstrdup(pa_modargs_get_value(ma, "file", DEFAULT_FI=
LE_NAME));
 =

@@ -291,7 +293,7 @@
     u->sink->userdata =3D u;
     =

     pa_sink_set_module(u->sink, m);
-    pa_sink_set_asyncmsgq(u->sink, u->asyncmsgq);
+    pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
     pa_sink_set_description(u->sink, t =3D pa_sprintf_malloc("Unix FIFO si=
nk '%s'", u->filename));
     pa_xfree(t);
 =

@@ -325,12 +327,11 @@
         pa_sink_disconnect(u->sink);
 =

     if (u->thread) {
-        pa_asyncmsgq_send(u->asyncmsgq, NULL, PA_MESSAGE_SHUTDOWN, NULL, 0=
, NULL);
+        pa_asyncmsgq_send(u->thread_mq.inq, NULL, PA_MESSAGE_SHUTDOWN, NUL=
L, 0, NULL);
         pa_thread_free(u->thread);
     }
 =

-    if (u->asyncmsgq)
-        pa_asyncmsgq_free(u->asyncmsgq);
+    pa_thread_mq_done(&u->thread_mq);
     =

     if (u->sink)
         pa_sink_unref(u->sink);

Modified: branches/lennart/src/modules/module-pipe-source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-pipe-source.c?rev=3D1624&root=3Dpulseaudio&r1=3D1623&r2=3D1624&view=3D=
diff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-pipe-source.c (original)
+++ branches/lennart/src/modules/module-pipe-source.c Sat Aug 11 00:02:39 2=
007
@@ -44,6 +44,7 @@
 #include <pulsecore/modargs.h>
 #include <pulsecore/log.h>
 #include <pulsecore/thread.h>
+#include <pulsecore/thread-mq.h>
 =

 #include "module-pipe-source-symdef.h"
 =

@@ -66,7 +67,7 @@
     pa_module *module;
     pa_source *source;
     pa_thread *thread;
-    pa_asyncmsgq *asyncmsgq;
+    pa_thread_mq thread_mq;
     =

     char *filename;
     int fd;
@@ -99,9 +100,11 @@
 =

     pa_log_debug("Thread starting up");
 =

+    pa_thread_mq_install(&u->thread_mq);
+
     memset(&pollfd, 0, sizeof(pollfd));
     =

-    pollfd[POLLFD_ASYNCQ].fd =3D pa_asyncmsgq_get_fd(u->asyncmsgq);
+    pollfd[POLLFD_ASYNCQ].fd =3D pa_asyncmsgq_get_fd(u->thread_mq.inq);
     pollfd[POLLFD_ASYNCQ].events =3D POLLIN;
     pollfd[POLLFD_FIFO].fd =3D u->fd;
 =

@@ -114,16 +117,16 @@
         int64_t offset;
 =

         /* Check whether there is a message for us to process */
-        if (pa_asyncmsgq_get(u->asyncmsgq, &object, &code, &data, &offset,=
 &chunk, 0) =3D=3D 0) {
+        if (pa_asyncmsgq_get(u->thread_mq.inq, &object, &code, &data, &off=
set, &chunk, 0) =3D=3D 0) {
             int ret;
 =

             if (!object && code =3D=3D PA_MESSAGE_SHUTDOWN) {
-                pa_asyncmsgq_done(u->asyncmsgq, 0);
+                pa_asyncmsgq_done(u->thread_mq.inq, 0);
                 goto finish;
             }
 =

             ret =3D pa_asyncmsgq_dispatch(object, code, data, offset, &chu=
nk);
-            pa_asyncmsgq_done(u->asyncmsgq, ret);
+            pa_asyncmsgq_done(u->thread_mq.inq, ret);
             continue;
         }
 =

@@ -175,14 +178,14 @@
 =

         /* Hmm, nothing to do. Let's sleep */
 =

-        if (pa_asyncmsgq_before_poll(u->asyncmsgq) < 0)
+        if (pa_asyncmsgq_before_poll(u->thread_mq.inq) < 0)
             continue;
 =

 /*         pa_log("polling for %i", pollfd[POLLFD_FIFO].events); */
         r =3D poll(pollfd, POLLFD_MAX, -1);
 /*         pa_log("polling got %i (r=3D%i) %i", r > 0 ? pollfd[POLLFD_FIFO=
].revents : 0, r, r > 0 ? pollfd[POLLFD_ASYNCQ].revents: 0); */
 =

-        pa_asyncmsgq_after_poll(u->asyncmsgq);
+        pa_asyncmsgq_after_poll(u->thread_mq.inq);
 =

         if (r < 0) {
             if (errno =3D=3D EINTR)
@@ -203,8 +206,8 @@
 fail:
     /* We have to continue processing messages until we receive the
      * SHUTDOWN message */
-    pa_asyncmsgq_post(u->core->asyncmsgq, PA_MSGOBJECT(u->core), PA_CORE_M=
ESSAGE_UNLOAD_MODULE, u->module, 0, NULL, NULL);
-    pa_asyncmsgq_wait_for(u->asyncmsgq, PA_MESSAGE_SHUTDOWN);
+    pa_asyncmsgq_post(u->thread_mq.outq, PA_MSGOBJECT(u->core), PA_CORE_ME=
SSAGE_UNLOAD_MODULE, u->module, 0, NULL, NULL);
+    pa_asyncmsgq_wait_for(u->thread_mq.inq, PA_MESSAGE_SHUTDOWN);
 =

 finish:
     pa_log_debug("Thread shutting down");
@@ -236,8 +239,7 @@
     u->module =3D m;
     m->userdata =3D u;
     pa_memchunk_reset(&u->memchunk);
-    =

-    pa_assert_se(u->asyncmsgq =3D pa_asyncmsgq_new(0));
+    pa_thread_mq_init(&u->thread_mq, m->core->mainloop);
 =

     u->filename =3D pa_xstrdup(pa_modargs_get_value(ma, "file", DEFAULT_FI=
LE_NAME));
     =

@@ -268,7 +270,7 @@
     u->source->userdata =3D u;
     =

     pa_source_set_module(u->source, m);
-    pa_source_set_asyncmsgq(u->source, u->asyncmsgq);
+    pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
     pa_source_set_description(u->source, t =3D pa_sprintf_malloc("Unix FIF=
O source '%s'", u->filename));
     pa_xfree(t);
 =

@@ -302,12 +304,11 @@
         pa_source_disconnect(u->source);
 =

     if (u->thread) {
-        pa_asyncmsgq_send(u->asyncmsgq, NULL, PA_MESSAGE_SHUTDOWN, NULL, 0=
, NULL);
+        pa_asyncmsgq_send(u->thread_mq.inq, NULL, PA_MESSAGE_SHUTDOWN, NUL=
L, 0, NULL);
         pa_thread_free(u->thread);
     }
 =

-    if (u->asyncmsgq)
-        pa_asyncmsgq_free(u->asyncmsgq);
+    pa_thread_mq_done(&u->thread_mq);
 =

     if (u->source)
         pa_source_unref(u->source);

Modified: branches/lennart/src/pulsecore/core.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
core.c?rev=3D1624&root=3Dpulseaudio&r1=3D1623&r2=3D1624&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/core.c (original)
+++ branches/lennart/src/pulsecore/core.c Sat Aug 11 00:02:39 2007
@@ -64,34 +64,6 @@
 =

         default:
             return -1;
-    }
-}
-
-static void asyncmsgq_cb(pa_mainloop_api*api, pa_io_event* e, int fd, pa_i=
o_event_flags_t events, void *userdata) {
-    pa_core *c =3D userdata;
-
-    pa_assert(pa_asyncmsgq_get_fd(c->asyncmsgq) =3D=3D fd);
-    pa_assert(events =3D=3D PA_IO_EVENT_INPUT);
-
-    pa_asyncmsgq_after_poll(c->asyncmsgq);
-
-    for (;;) {
-        pa_msgobject *object;
-        int code;
-        void *data;
-        int64_t offset;
-        pa_memchunk chunk;
-
-        /* Check whether there is a message for us to process */
-        while (pa_asyncmsgq_get(c->asyncmsgq, &object, &code, &data, &offs=
et, &chunk, 0) =3D=3D 0) {
-            int ret;
-
-            ret =3D pa_asyncmsgq_dispatch(object, code, data, offset, &chu=
nk);
-            pa_asyncmsgq_done(c->asyncmsgq, ret);
-        }
-
-        if (pa_asyncmsgq_before_poll(c->asyncmsgq) =3D=3D 0)
-            break;
     }
 }
 =

@@ -189,10 +161,6 @@
     pa_check_signal_is_blocked(SIGPIPE);
 #endif
 =

-    pa_assert_se(c->asyncmsgq =3D pa_asyncmsgq_new(0));
-    pa_assert_se(pa_asyncmsgq_before_poll(c->asyncmsgq) =3D=3D 0);
-    pa_assert_se(c->asyncmsgq_event =3D c->mainloop->io_new(c->mainloop, p=
a_asyncmsgq_get_fd(c->asyncmsgq), PA_IO_EVENT_INPUT, asyncmsgq_cb, c));
-
     return c;
 }
 =

@@ -229,14 +197,9 @@
     pa_xfree(c->default_source_name);
     pa_xfree(c->default_sink_name);
 =

-    pa_asyncmsgq_after_poll(c->asyncmsgq);
-    pa_asyncmsgq_free(c->asyncmsgq);
-
     pa_mempool_free(c->mempool);
 =

     pa_property_cleanup(c);
-
-    c->mainloop->io_free(c->asyncmsgq_event);
 =

     pa_hook_free(&c->hook_sink_new);
     pa_hook_free(&c->hook_sink_new_post);
@@ -260,13 +223,13 @@
 =

 static void quit_callback(pa_mainloop_api*m, pa_time_event *e, PA_GCC_UNUS=
ED const struct timeval *tv, void *userdata) {
     pa_core *c =3D userdata;
-    assert(c->quit_event =3D e);
+    pa_assert(c->quit_event =3D e);
 =

     m->quit(m, 0);
 }
 =

 void pa_core_check_quit(pa_core *c) {
-    assert(c);
+    pa_assert(c);
 =

     if (!c->quit_event && c->exit_idle_time >=3D 0 && pa_idxset_size(c->cl=
ients) =3D=3D 0) {
         struct timeval tv;

Modified: branches/lennart/src/pulsecore/core.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
core.h?rev=3D1624&root=3Dpulseaudio&r1=3D1623&r2=3D1624&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/core.h (original)
+++ branches/lennart/src/pulsecore/core.h Sat Aug 11 00:02:39 2007
@@ -104,9 +104,6 @@
         hook_source_output_new_post,
         hook_source_output_disconnect,
         hook_source_output_disconnect_post;
-
-    pa_asyncmsgq *asyncmsgq;
-    pa_io_event *asyncmsgq_event;
 };
 =

 PA_DECLARE_CLASS(pa_core);

Modified: branches/lennart/src/pulsecore/play-memchunk.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
play-memchunk.c?rev=3D1624&root=3Dpulseaudio&r1=3D1623&r2=3D1624&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/play-memchunk.c (original)
+++ branches/lennart/src/pulsecore/play-memchunk.c Sat Aug 11 00:02:39 2007
@@ -33,6 +33,7 @@
 =

 #include <pulsecore/sink-input.h>
 #include <pulsecore/gccmacro.h>
+#include <pulsecore/thread-mq.h>
 =

 #include "play-memchunk.h"
 =

@@ -111,7 +112,7 @@
     if (u->memchunk.length <=3D 0) {
         pa_memblock_unref(u->memchunk.memblock);
         u->memchunk.memblock =3D NULL;
-        pa_asyncmsgq_post(u->core->asyncmsgq, PA_MSGOBJECT(u), MEMCHUNK_ST=
REAM_MESSAGE_UNLINK, NULL, 0, NULL, NULL);
+        pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(u), MEMCH=
UNK_STREAM_MESSAGE_UNLINK, NULL, 0, NULL, NULL);
         return -1;
     }
 =


Modified: branches/lennart/src/pulsecore/protocol-esound.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
protocol-esound.c?rev=3D1624&root=3Dpulseaudio&r1=3D1623&r2=3D1624&view=3Dd=
iff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/protocol-esound.c (original)
+++ branches/lennart/src/pulsecore/protocol-esound.c Sat Aug 11 00:02:39 20=
07
@@ -53,6 +53,7 @@
 #include <pulsecore/core-error.h>
 #include <pulsecore/ipacl.h>
 #include <pulsecore/macro.h>
+#include <pulsecore/thread-mq.h>
 =

 #include "endianmacros.h"
 =

@@ -1194,6 +1195,7 @@
 =

 /*** sink_input callbacks ***/
 =

+/* Called from thread context */
 static int sink_input_process_msg(pa_msgobject *o, int code, void *userdat=
a, int64_t offset, pa_memchunk *chunk) {
     pa_sink_input *i =3D PA_SINK_INPUT(o);
     connection*c;
@@ -1234,7 +1236,7 @@
     }
 }
 =

-
+/* Called from thread context */
 static int sink_input_peek_cb(pa_sink_input *i, pa_memchunk *chunk) {
     connection*c;
     int r;
@@ -1245,11 +1247,12 @@
     pa_assert(chunk);
 =

     if ((r =3D pa_memblockq_peek(c->input_memblockq, chunk)) < 0 && c->dea=
d)
-        pa_asyncmsgq_post(c->protocol->core->asyncmsgq, PA_MSGOBJECT(c), C=
ONNECTION_MESSAGE_UNLINK_CONNECTION, NULL, 0, NULL, NULL);
+        pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(c), CONNE=
CTION_MESSAGE_UNLINK_CONNECTION, NULL, 0, NULL, NULL);
 =

     return r;
 }
 =

+/* Called from thread context */
 static void sink_input_drop_cb(pa_sink_input *i, size_t length) {
     connection*c;
     size_t old, new;
@@ -1267,7 +1270,7 @@
 =

     if (new > old) {
         if (pa_atomic_add(&c->playback.missing, new - old) <=3D 0)
-            pa_asyncmsgq_post(c->protocol->core->asyncmsgq, PA_MSGOBJECT(c=
), CONNECTION_MESSAGE_REQUEST_DATA, NULL, 0, NULL, NULL);
+            pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(c), C=
ONNECTION_MESSAGE_REQUEST_DATA, NULL, 0, NULL, NULL);
     }
 }
 =

@@ -1279,6 +1282,7 @@
 =

 /*** source_output callbacks ***/
 =

+/* Called from thread context */
 static void source_output_push_cb(pa_source_output *o, const pa_memchunk *=
chunk) {
     connection *c;
 =

@@ -1287,7 +1291,7 @@
     pa_assert(c);
     pa_assert(chunk);
 =

-    pa_asyncmsgq_post(c->protocol->core->asyncmsgq, PA_MSGOBJECT(c), CONNE=
CTION_MESSAGE_POST_DATA, NULL, 0, chunk, NULL);
+    pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(c), CONNECTIO=
N_MESSAGE_POST_DATA, NULL, 0, chunk, NULL);
 }
 =

 static void source_output_kill_cb(pa_source_output *o) {

Modified: branches/lennart/src/pulsecore/protocol-native.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
protocol-native.c?rev=3D1624&root=3Dpulseaudio&r1=3D1623&r2=3D1624&view=3Dd=
iff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/protocol-native.c (original)
+++ branches/lennart/src/pulsecore/protocol-native.c Sat Aug 11 00:02:39 20=
07
@@ -60,6 +60,7 @@
 #include <pulsecore/creds.h>
 #include <pulsecore/core-util.h>
 #include <pulsecore/ipacl.h>
+#include <pulsecore/thread-mq.h>
 =

 #include "protocol-native.h"
 =

@@ -752,7 +753,7 @@
 =

     previous_missing =3D pa_atomic_add(&s->missing, delta);
     if (previous_missing < pa_memblockq_get_minreq(s->memblockq) && previo=
us_missing+delta >=3D pa_memblockq_get_minreq(s->memblockq))
-        pa_asyncmsgq_post(s->connection->protocol->core->asyncmsgq, PA_MSG=
OBJECT(s), PLAYBACK_STREAM_MESSAGE_REQUEST_DATA, NULL, 0, NULL, NULL);
+        pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(s), PLAYB=
ACK_STREAM_MESSAGE_REQUEST_DATA, NULL, 0, NULL, NULL);
 }
 =

 static void send_memblock(connection *c) {
@@ -833,7 +834,7 @@
             if (pa_memblockq_push_align(s->memblockq, chunk) < 0) {
 =

                 pa_log_warn("Failed to push data into queue");
-                pa_asyncmsgq_post(s->connection->protocol->core->asyncmsgq=
, PA_MSGOBJECT(s), PLAYBACK_STREAM_MESSAGE_OVERFLOW, NULL, 0, NULL, NULL);
+                pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(s=
), PLAYBACK_STREAM_MESSAGE_OVERFLOW, NULL, 0, NULL, NULL);
                 pa_memblockq_seek(s->memblockq, chunk->length, PA_SEEK_REL=
ATIVE);
             }
 =

@@ -848,7 +849,7 @@
             pa_memblockq_prebuf_disable(s->memblockq);
 =

             if (!pa_memblockq_is_readable(s->memblockq))
-                pa_asyncmsgq_post(s->connection->protocol->core->asyncmsgq=
, PA_MSGOBJECT(s), PLAYBACK_STREAM_MESSAGE_DRAIN_ACK, userdata, 0, NULL, NU=
LL);
+                pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(s=
), PLAYBACK_STREAM_MESSAGE_DRAIN_ACK, userdata, 0, NULL, NULL);
             else {
                 s->drain_tag =3D PA_PTR_TO_UINT(userdata);
                 s->drain_request =3D 1;
@@ -941,7 +942,7 @@
     pa_assert(chunk);
 =

     if (pa_memblockq_get_length(s->memblockq) <=3D 0 && !s->underrun) {
-        pa_asyncmsgq_post(s->connection->protocol->core->asyncmsgq, PA_MSG=
OBJECT(s), PLAYBACK_STREAM_MESSAGE_UNDERFLOW, NULL, 0, NULL, NULL);
+        pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(s), PLAYB=
ACK_STREAM_MESSAGE_UNDERFLOW, NULL, 0, NULL, NULL);
         s->underrun =3D 1;
     }
 =

@@ -970,7 +971,7 @@
 =

     if (s->drain_request && !pa_memblockq_is_readable(s->memblockq)) {
         s->drain_request =3D 0;
-        pa_asyncmsgq_post(s->connection->protocol->core->asyncmsgq, PA_MSG=
OBJECT(s), PLAYBACK_STREAM_MESSAGE_DRAIN_ACK, PA_UINT_TO_PTR(s->drain_tag),=
 0, NULL, NULL);
+        pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(s), PLAYB=
ACK_STREAM_MESSAGE_DRAIN_ACK, PA_UINT_TO_PTR(s->drain_tag), 0, NULL, NULL);
     }
 =

     request_bytes(s);
@@ -1000,7 +1001,7 @@
     record_stream_assert_ref(s);
     pa_assert(chunk);
 =

-    pa_asyncmsgq_post(s->connection->protocol->core->asyncmsgq, PA_MSGOBJE=
CT(s), RECORD_STREAM_MESSAGE_POST_DATA, NULL, 0, chunk, NULL);
+    pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(s), RECORD_ST=
REAM_MESSAGE_POST_DATA, NULL, 0, chunk, NULL);
 }
 =

 static void source_output_kill_cb(pa_source_output *o) {

Modified: branches/lennart/src/pulsecore/protocol-simple.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
protocol-simple.c?rev=3D1624&root=3Dpulseaudio&r1=3D1623&r2=3D1624&view=3Dd=
iff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/protocol-simple.c (original)
+++ branches/lennart/src/pulsecore/protocol-simple.c Sat Aug 11 00:02:39 20=
07
@@ -41,6 +41,7 @@
 #include <pulsecore/log.h>
 #include <pulsecore/core-error.h>
 #include <pulsecore/atomic.h>
+#include <pulsecore/thread-mq.h>
 =

 #include "protocol-simple.h"
 =

@@ -356,7 +357,7 @@
 /*     pa_log("peeked %u %i", r >=3D 0 ? chunk->length: 0, r); */
 =

     if (c->dead && r < 0)
-        pa_asyncmsgq_post(c->protocol->core->asyncmsgq, PA_MSGOBJECT(c), C=
ONNECTION_MESSAGE_UNLINK_CONNECTION, NULL, 0, NULL, NULL);
+        pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(c), CONNE=
CTION_MESSAGE_UNLINK_CONNECTION, NULL, 0, NULL, NULL);
 =

     return r;
 }
@@ -377,7 +378,7 @@
 =

     if (new > old) {
         if (pa_atomic_add(&c->playback.missing, new - old) <=3D 0)
-            pa_asyncmsgq_post(c->protocol->core->asyncmsgq, PA_MSGOBJECT(c=
), CONNECTION_MESSAGE_REQUEST_DATA, NULL, 0, NULL, NULL);
+            pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(c), C=
ONNECTION_MESSAGE_REQUEST_DATA, NULL, 0, NULL, NULL);
     }
 }
 =

@@ -399,7 +400,7 @@
     pa_assert(c);
     pa_assert(chunk);
 =

-    pa_asyncmsgq_post(c->protocol->core->asyncmsgq, PA_MSGOBJECT(c), CONNE=
CTION_MESSAGE_POST_DATA, NULL, 0, chunk, NULL);
+    pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(c), CONNECTIO=
N_MESSAGE_POST_DATA, NULL, 0, chunk, NULL);
 }
 =

 /* Called from main context */

Modified: branches/lennart/src/pulsecore/sound-file-stream.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
sound-file-stream.c?rev=3D1624&root=3Dpulseaudio&r1=3D1623&r2=3D1624&view=
=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/sound-file-stream.c (original)
+++ branches/lennart/src/pulsecore/sound-file-stream.c Sat Aug 11 00:02:39 =
2007
@@ -39,6 +39,7 @@
 #include <pulsecore/core-error.h>
 #include <pulsecore/sink-input.h>
 #include <pulsecore/log.h>
+#include <pulsecore/thread-mq.h>
 =

 #include "sound-file-stream.h"
 =

@@ -161,7 +162,7 @@
                 pa_memblock_unref(u->memchunk.memblock);
                 pa_memchunk_reset(&u->memchunk);
                 =

-                pa_asyncmsgq_post(u->core->asyncmsgq, PA_MSGOBJECT(u), FIL=
E_STREAM_MESSAGE_UNLINK, NULL, 0, NULL, NULL);
+                pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(u=
), FILE_STREAM_MESSAGE_UNLINK, NULL, 0, NULL, NULL);
 =

                 sf_close(u->sndfile);
                 u->sndfile =3D NULL;




More information about the pulseaudio-commits mailing list