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
This commit is contained in:
Lennart Poettering 2007-08-30 22:42:47 +00:00
parent 687f1f15fc
commit 821eb8e295
2 changed files with 27 additions and 0 deletions

View file

@ -117,3 +117,27 @@ pa_thread_mq *pa_thread_mq_get(void) {
return pa_tls_get(tls); 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;
}

View file

@ -43,6 +43,9 @@ void pa_thread_mq_done(pa_thread_mq *q);
/* Install the specified pa_thread_mq object for the current thread */ /* Install the specified pa_thread_mq object for the current thread */
void pa_thread_mq_install(pa_thread_mq *q); 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 */ /* Return the pa_thread_mq object that is set for the current thread */
pa_thread_mq *pa_thread_mq_get(void); pa_thread_mq *pa_thread_mq_get(void);