summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-08-30 22:42:47 +0000
committerLennart Poettering <lennart@poettering.net>2007-08-30 22:42:47 +0000
commit821eb8e29589baed2564e52fa956d34e6f2ce4d3 (patch)
tree0c726c07bf3dc14e975c2687c3aecf99bcb5ca24
parent687f1f15fc3fcd99ce79cc402c48ec6a469f0333 (diff)
move queue processing code into pa_thread_mq
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1730 fefdeb5f-60dc-0310-8127-8f9354f1896f
-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);