summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/pulsecore/thread-mq.c24
-rw-r--r--src/pulsecore/thread-mq.h3
2 files changed, 27 insertions, 0 deletions
diff --git a/src/pulsecore/thread-mq.c b/src/pulsecore/thread-mq.c
index 513409d4..3c466ceb 100644
--- a/src/pulsecore/thread-mq.c
+++ b/src/pulsecore/thread-mq.c
@@ -117,3 +117,27 @@ pa_thread_mq *pa_thread_mq_get(void) {
return pa_tls_get(tls);
}
+int pa_thread_mq_process(pa_thread_mq *q) {
+ pa_msgobject *object;
+ int code;
+ void *data;
+ pa_memchunk chunk;
+ int64_t offset;
+
+ pa_assert(q);
+
+ if (pa_asyncmsgq_get(q->inq, &object, &code, &data, &offset, &chunk, 0) == 0) {
+ int ret;
+
+ if (!object && code == PA_MESSAGE_SHUTDOWN) {
+ pa_asyncmsgq_done(q->inq, 0);
+ return -1;
+ }
+
+ ret = pa_asyncmsgq_dispatch(object, code, data, offset, &chunk);
+ pa_asyncmsgq_done(q->inq, ret);
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/src/pulsecore/thread-mq.h b/src/pulsecore/thread-mq.h
index 13b6e01f..2b1fd687 100644
--- a/src/pulsecore/thread-mq.h
+++ b/src/pulsecore/thread-mq.h
@@ -43,6 +43,9 @@ void pa_thread_mq_done(pa_thread_mq *q);
/* Install the specified pa_thread_mq object for the current thread */
void pa_thread_mq_install(pa_thread_mq *q);
+/* Dispatched queued events on the thread side. */
+int pa_thread_mq_process(pa_thread_mq *q);
+
/* Return the pa_thread_mq object that is set for the current thread */
pa_thread_mq *pa_thread_mq_get(void);