return 0;
}
-static pa_bool_t flush_postq(pa_asyncq *l) {
+static pa_bool_t flush_postq(pa_asyncq *l, pa_bool_t wait) {
struct localq *q;
pa_assert(l);
while ((q = l->last_localq)) {
- if (push(l, q->data, FALSE) < 0)
+ if (push(l, q->data, wait) < 0)
return FALSE;
l->last_localq = q->prev;
int pa_asyncq_push(pa_asyncq*l, void *p, pa_bool_t wait) {
pa_assert(l);
- if (!flush_postq(l))
+ if (!flush_postq(l, wait))
return -1;
return push(l, p, wait);
pa_assert(l);
pa_assert(p);
- if (pa_asyncq_push(l, p, FALSE) >= 0)
- return;
+ if (flush_postq(l, FALSE))
+ if (pa_asyncq_push(l, p, FALSE) >= 0)
+ return;
/* OK, we couldn't push anything in the queue. So let's queue it
* locally and push it later */
for (;;) {
- if (flush_postq(l))
+ if (flush_postq(l, FALSE))
break;
if (pa_fdsem_before_poll(l->read_fdsem) >= 0) {