void pa_asyncq_write_before_poll(pa_asyncq *l) { pa_assert(l); for (;;) { if (flush_postq(l, FALSE)) break; if (pa_fdsem_before_poll(l->read_fdsem) >= 0) { l->waiting_for_post = TRUE; break; } } }
int pa_asyncq_read_before_poll(pa_asyncq *l) { unsigned idx; pa_atomic_ptr_t *cells; pa_assert(l); cells = PA_ASYNCQ_CELLS(l); _Y; idx = reduce(l, l->read_idx); for (;;) { if (pa_atomic_ptr_load(&cells[idx])) return -1; if (pa_fdsem_before_poll(l->write_fdsem) >= 0) return 0; } }
static void srbchannel_rwloop(pa_srbchannel* sr) { do { #ifdef DEBUG_SRBCHANNEL int q; pa_ringbuffer_peek(&sr->rb_read, &q); pa_log("In rw loop from srbchannel, before callback, count = %d", q); #endif if (sr->callback) { if (!sr->callback(sr, sr->cb_userdata)) { #ifdef DEBUG_SRBCHANNEL pa_log("Aborting read loop from srbchannel"); #endif return; } } #ifdef DEBUG_SRBCHANNEL pa_ringbuffer_peek(&sr->rb_read, &q); pa_log("In rw loop from srbchannel, after callback, count = %d", q); #endif } while (pa_fdsem_before_poll(sr->sem_read) < 0); }