Prepare for a single iteration of the main loop. Returns a negative value on error or exit request. timeout specifies a maximum timeout for the subsequent poll, or -1 for blocking behaviour. . Definition at line 818 of file mainloop.c. References PA_USEC_INVALID, and PA_USEC_PER_MSEC. { pa_assert(m); pa_assert(m->state == STATE_PASSIVE); clear_wakeup(m); scan_dead(m); if (m->quit) goto quit; if (m->n_enabled_defer_events <= 0) { if (m->rebuild_pollfds) rebuild_pollfds(m); m->prepared_timeout = calc_next_timeout(m); if (timeout >= 0) { uint64_t u = (uint64_t) timeout * PA_USEC_PER_MSEC; if (u < m->prepared_timeout || m->prepared_timeout == PA_USEC_INVALID) m->prepared_timeout = timeout; } } m->state = STATE_PREPARED; return 0; quit: m->state = STATE_QUIT; return -2; }
|