mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
Move the poll() call outside the #ifdef checking for ppoll, since we want the poll in all cases. Prior to this change the check for negative return values of poll/ppoll was never actually executed when ppoll() was available
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1915 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
f8c17861b8
commit
229afb5e2d
1 changed files with 60 additions and 61 deletions
|
|
@ -62,9 +62,9 @@ struct pa_rtpoll {
|
||||||
timer_t timer;
|
timer_t timer;
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
pa_bool_t dont_use_ppoll;
|
pa_bool_t dont_use_ppoll;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
PA_LLIST_HEAD(pa_rtpoll_item, items);
|
PA_LLIST_HEAD(pa_rtpoll_item, items);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -81,7 +81,7 @@ struct pa_rtpoll_item {
|
||||||
int (*before_cb)(pa_rtpoll_item *i);
|
int (*before_cb)(pa_rtpoll_item *i);
|
||||||
void (*after_cb)(pa_rtpoll_item *i);
|
void (*after_cb)(pa_rtpoll_item *i);
|
||||||
void *userdata;
|
void *userdata;
|
||||||
|
|
||||||
PA_LLIST_FIELDS(pa_rtpoll_item);
|
PA_LLIST_FIELDS(pa_rtpoll_item);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -99,11 +99,11 @@ pa_rtpoll *pa_rtpoll_new(void) {
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
/* ppoll is broken on Linux < 2.6.16 */
|
/* ppoll is broken on Linux < 2.6.16 */
|
||||||
p->dont_use_ppoll = FALSE;
|
p->dont_use_ppoll = FALSE;
|
||||||
|
|
||||||
{
|
{
|
||||||
struct utsname u;
|
struct utsname u;
|
||||||
unsigned major, minor, micro;
|
unsigned major, minor, micro;
|
||||||
|
|
||||||
pa_assert_se(uname(&u) == 0);
|
pa_assert_se(uname(&u) == 0);
|
||||||
|
|
||||||
if (sscanf(u.release, "%u.%u.%u", &major, &minor, µ) != 3 ||
|
if (sscanf(u.release, "%u.%u.%u", &major, &minor, µ) != 3 ||
|
||||||
|
|
@ -119,7 +119,7 @@ pa_rtpoll *pa_rtpoll_new(void) {
|
||||||
p->rtsig = -1;
|
p->rtsig = -1;
|
||||||
sigemptyset(&p->sigset_unblocked);
|
sigemptyset(&p->sigset_unblocked);
|
||||||
p->timer = (timer_t) -1;
|
p->timer = (timer_t) -1;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
p->n_pollfd_alloc = 32;
|
p->n_pollfd_alloc = 32;
|
||||||
|
|
@ -136,7 +136,7 @@ pa_rtpoll *pa_rtpoll_new(void) {
|
||||||
p->scan_for_dead = FALSE;
|
p->scan_for_dead = FALSE;
|
||||||
p->rebuild_needed = FALSE;
|
p->rebuild_needed = FALSE;
|
||||||
p->quit = FALSE;
|
p->quit = FALSE;
|
||||||
|
|
||||||
PA_LLIST_HEAD_INIT(pa_rtpoll_item, p->items);
|
PA_LLIST_HEAD_INIT(pa_rtpoll_item, p->items);
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
|
@ -145,7 +145,7 @@ pa_rtpoll *pa_rtpoll_new(void) {
|
||||||
void pa_rtpoll_install(pa_rtpoll *p) {
|
void pa_rtpoll_install(pa_rtpoll *p) {
|
||||||
pa_assert(p);
|
pa_assert(p);
|
||||||
pa_assert(!p->installed);
|
pa_assert(!p->installed);
|
||||||
|
|
||||||
p->installed = 1;
|
p->installed = 1;
|
||||||
|
|
||||||
#ifdef HAVE_PPOLL
|
#ifdef HAVE_PPOLL
|
||||||
|
|
@ -162,7 +162,7 @@ void pa_rtpoll_install(pa_rtpoll *p) {
|
||||||
{
|
{
|
||||||
sigset_t ss;
|
sigset_t ss;
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
pa_assert_se(sigemptyset(&ss) == 0);
|
pa_assert_se(sigemptyset(&ss) == 0);
|
||||||
pa_assert_se(sigaddset(&ss, p->rtsig) == 0);
|
pa_assert_se(sigaddset(&ss, p->rtsig) == 0);
|
||||||
pa_assert_se(pthread_sigmask(SIG_BLOCK, &ss, &p->sigset_unblocked) == 0);
|
pa_assert_se(pthread_sigmask(SIG_BLOCK, &ss, &p->sigset_unblocked) == 0);
|
||||||
|
|
@ -171,12 +171,12 @@ void pa_rtpoll_install(pa_rtpoll *p) {
|
||||||
memset(&sa, 0, sizeof(sa));
|
memset(&sa, 0, sizeof(sa));
|
||||||
sa.sa_handler = signal_handler_noop;
|
sa.sa_handler = signal_handler_noop;
|
||||||
pa_assert_se(sigemptyset(&sa.sa_mask) == 0);
|
pa_assert_se(sigemptyset(&sa.sa_mask) == 0);
|
||||||
|
|
||||||
pa_assert_se(sigaction(p->rtsig, &sa, NULL) == 0);
|
pa_assert_se(sigaction(p->rtsig, &sa, NULL) == 0);
|
||||||
|
|
||||||
/* We never reset the signal handler. Why should we? */
|
/* We never reset the signal handler. Why should we? */
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -185,7 +185,7 @@ static void rtpoll_rebuild(pa_rtpoll *p) {
|
||||||
struct pollfd *e, *t;
|
struct pollfd *e, *t;
|
||||||
pa_rtpoll_item *i;
|
pa_rtpoll_item *i;
|
||||||
int ra = 0;
|
int ra = 0;
|
||||||
|
|
||||||
pa_assert(p);
|
pa_assert(p);
|
||||||
|
|
||||||
p->rebuild_needed = FALSE;
|
p->rebuild_needed = FALSE;
|
||||||
|
|
@ -203,7 +203,7 @@ static void rtpoll_rebuild(pa_rtpoll *p) {
|
||||||
|
|
||||||
if (i->n_pollfd > 0) {
|
if (i->n_pollfd > 0) {
|
||||||
size_t l = i->n_pollfd * sizeof(struct pollfd);
|
size_t l = i->n_pollfd * sizeof(struct pollfd);
|
||||||
|
|
||||||
if (i->pollfd)
|
if (i->pollfd)
|
||||||
memcpy(e, i->pollfd, l);
|
memcpy(e, i->pollfd, l);
|
||||||
else
|
else
|
||||||
|
|
@ -212,7 +212,7 @@ static void rtpoll_rebuild(pa_rtpoll *p) {
|
||||||
i->pollfd = e;
|
i->pollfd = e;
|
||||||
} else
|
} else
|
||||||
i->pollfd = NULL;
|
i->pollfd = NULL;
|
||||||
|
|
||||||
e += i->n_pollfd;
|
e += i->n_pollfd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -220,7 +220,7 @@ static void rtpoll_rebuild(pa_rtpoll *p) {
|
||||||
t = p->pollfd;
|
t = p->pollfd;
|
||||||
p->pollfd = p->pollfd2;
|
p->pollfd = p->pollfd2;
|
||||||
p->pollfd2 = t;
|
p->pollfd2 = t;
|
||||||
|
|
||||||
if (ra)
|
if (ra)
|
||||||
p->pollfd2 = pa_xrealloc(p->pollfd2, p->n_pollfd_alloc * sizeof(struct pollfd));
|
p->pollfd2 = pa_xrealloc(p->pollfd2, p->n_pollfd_alloc * sizeof(struct pollfd));
|
||||||
|
|
||||||
|
|
@ -236,7 +236,7 @@ static void rtpoll_item_destroy(pa_rtpoll_item *i) {
|
||||||
PA_LLIST_REMOVE(pa_rtpoll_item, p->items, i);
|
PA_LLIST_REMOVE(pa_rtpoll_item, p->items, i);
|
||||||
|
|
||||||
p->n_pollfd_used -= i->n_pollfd;
|
p->n_pollfd_used -= i->n_pollfd;
|
||||||
|
|
||||||
if (pa_flist_push(PA_STATIC_FLIST_GET(items), i) < 0)
|
if (pa_flist_push(PA_STATIC_FLIST_GET(items), i) < 0)
|
||||||
pa_xfree(i);
|
pa_xfree(i);
|
||||||
|
|
||||||
|
|
@ -253,22 +253,22 @@ void pa_rtpoll_free(pa_rtpoll *p) {
|
||||||
pa_xfree(p->pollfd2);
|
pa_xfree(p->pollfd2);
|
||||||
|
|
||||||
#ifdef HAVE_PPOLL
|
#ifdef HAVE_PPOLL
|
||||||
if (p->timer != (timer_t) -1)
|
if (p->timer != (timer_t) -1)
|
||||||
timer_delete(p->timer);
|
timer_delete(p->timer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pa_xfree(p);
|
pa_xfree(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reset_revents(pa_rtpoll_item *i) {
|
static void reset_revents(pa_rtpoll_item *i) {
|
||||||
struct pollfd *f;
|
struct pollfd *f;
|
||||||
unsigned n;
|
unsigned n;
|
||||||
|
|
||||||
pa_assert(i);
|
pa_assert(i);
|
||||||
|
|
||||||
if (!(f = pa_rtpoll_item_get_pollfd(i, &n)))
|
if (!(f = pa_rtpoll_item_get_pollfd(i, &n)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (; n > 0; n--)
|
for (; n > 0; n--)
|
||||||
f[n-1].revents = 0;
|
f[n-1].revents = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -277,12 +277,12 @@ static void reset_all_revents(pa_rtpoll *p) {
|
||||||
pa_rtpoll_item *i;
|
pa_rtpoll_item *i;
|
||||||
|
|
||||||
pa_assert(p);
|
pa_assert(p);
|
||||||
|
|
||||||
for (i = p->items; i; i = i->next) {
|
for (i = p->items; i; i = i->next) {
|
||||||
|
|
||||||
if (i->dead)
|
if (i->dead)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
reset_revents(i);
|
reset_revents(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -291,30 +291,30 @@ int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait) {
|
||||||
pa_rtpoll_item *i;
|
pa_rtpoll_item *i;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
struct timespec timeout;
|
struct timespec timeout;
|
||||||
|
|
||||||
pa_assert(p);
|
pa_assert(p);
|
||||||
pa_assert(!p->running);
|
pa_assert(!p->running);
|
||||||
pa_assert(p->installed);
|
pa_assert(p->installed);
|
||||||
|
|
||||||
p->running = TRUE;
|
p->running = TRUE;
|
||||||
|
|
||||||
/* First, let's do some work */
|
/* First, let's do some work */
|
||||||
for (i = p->items; i && i->priority < PA_RTPOLL_NEVER; i = i->next) {
|
for (i = p->items; i && i->priority < PA_RTPOLL_NEVER; i = i->next) {
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
if (i->dead)
|
if (i->dead)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!i->work_cb)
|
if (!i->work_cb)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (p->quit)
|
if (p->quit)
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
||||||
if ((k = i->work_cb(i)) != 0) {
|
if ((k = i->work_cb(i)) != 0) {
|
||||||
if (k < 0)
|
if (k < 0)
|
||||||
r = k;
|
r = k;
|
||||||
|
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -322,10 +322,10 @@ int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait) {
|
||||||
/* Now let's prepare for entering the sleep */
|
/* Now let's prepare for entering the sleep */
|
||||||
for (i = p->items; i && i->priority < PA_RTPOLL_NEVER; i = i->next) {
|
for (i = p->items; i && i->priority < PA_RTPOLL_NEVER; i = i->next) {
|
||||||
int k = 0;
|
int k = 0;
|
||||||
|
|
||||||
if (i->dead)
|
if (i->dead)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!i->before_cb)
|
if (!i->before_cb)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -334,10 +334,10 @@ int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait) {
|
||||||
/* Hmm, this one doesn't let us enter the poll, so rewind everything */
|
/* Hmm, this one doesn't let us enter the poll, so rewind everything */
|
||||||
|
|
||||||
for (i = i->prev; i; i = i->prev) {
|
for (i = i->prev; i; i = i->prev) {
|
||||||
|
|
||||||
if (i->dead)
|
if (i->dead)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!i->after_cb)
|
if (!i->after_cb)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -346,7 +346,7 @@ int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait) {
|
||||||
|
|
||||||
if (k < 0)
|
if (k < 0)
|
||||||
r = k;
|
r = k;
|
||||||
|
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -367,7 +367,7 @@ int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait) {
|
||||||
else
|
else
|
||||||
pa_timespec_store(&timeout, pa_timespec_diff(&p->next_elapse, &now));
|
pa_timespec_store(&timeout, pa_timespec_diff(&p->next_elapse, &now));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OK, now let's sleep */
|
/* OK, now let's sleep */
|
||||||
#ifdef HAVE_PPOLL
|
#ifdef HAVE_PPOLL
|
||||||
|
|
||||||
|
|
@ -379,17 +379,16 @@ int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait) {
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
|
||||||
r = poll(p->pollfd, p->n_pollfd_used, p->timer_enabled > 0 ? (timeout.tv_sec*1000) + (timeout.tv_nsec / 1000000) : -1);
|
|
||||||
#endif
|
#endif
|
||||||
|
r = poll(p->pollfd, p->n_pollfd_used, p->timer_enabled > 0 ? (timeout.tv_sec*1000) + (timeout.tv_nsec / 1000000) : -1);
|
||||||
|
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
reset_all_revents(p);
|
|
||||||
|
|
||||||
if (errno == EAGAIN || errno == EINTR)
|
if (errno == EAGAIN || errno == EINTR)
|
||||||
r = 0;
|
r = 0;
|
||||||
else
|
else
|
||||||
pa_log_error("poll(): %s", pa_cstrerror(errno));
|
pa_log_error("poll(): %s", pa_cstrerror(errno));
|
||||||
|
|
||||||
|
reset_all_revents(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->timer_enabled) {
|
if (p->timer_enabled) {
|
||||||
|
|
@ -422,12 +421,12 @@ int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait) {
|
||||||
finish:
|
finish:
|
||||||
|
|
||||||
p->running = FALSE;
|
p->running = FALSE;
|
||||||
|
|
||||||
if (p->scan_for_dead) {
|
if (p->scan_for_dead) {
|
||||||
pa_rtpoll_item *n;
|
pa_rtpoll_item *n;
|
||||||
|
|
||||||
p->scan_for_dead = FALSE;
|
p->scan_for_dead = FALSE;
|
||||||
|
|
||||||
for (i = p->items; i; i = n) {
|
for (i = p->items; i; i = n) {
|
||||||
n = i->next;
|
n = i->next;
|
||||||
|
|
||||||
|
|
@ -447,7 +446,7 @@ static void update_timer(pa_rtpoll *p) {
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
if (!p->dont_use_ppoll) {
|
if (!p->dont_use_ppoll) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (p->timer == (timer_t) -1) {
|
if (p->timer == (timer_t) -1) {
|
||||||
struct sigevent se;
|
struct sigevent se;
|
||||||
|
|
||||||
|
|
@ -473,7 +472,7 @@ static void update_timer(pa_rtpoll *p) {
|
||||||
* "disarming" */
|
* "disarming" */
|
||||||
if (its.it_value.tv_sec == 0)
|
if (its.it_value.tv_sec == 0)
|
||||||
its.it_value.tv_nsec = 1;
|
its.it_value.tv_nsec = 1;
|
||||||
|
|
||||||
if (p->period > 0)
|
if (p->period > 0)
|
||||||
pa_timespec_store(&its.it_interval, p->period);
|
pa_timespec_store(&its.it_interval, p->period);
|
||||||
}
|
}
|
||||||
|
|
@ -484,18 +483,18 @@ static void update_timer(pa_rtpoll *p) {
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void pa_rtpoll_set_timer_absolute(pa_rtpoll *p, const struct timespec *ts) {
|
void pa_rtpoll_set_timer_absolute(pa_rtpoll *p, const struct timespec *ts) {
|
||||||
pa_assert(p);
|
pa_assert(p);
|
||||||
pa_assert(ts);
|
pa_assert(ts);
|
||||||
|
|
||||||
p->next_elapse = *ts;
|
p->next_elapse = *ts;
|
||||||
p->period = 0;
|
p->period = 0;
|
||||||
p->timer_enabled = TRUE;
|
p->timer_enabled = TRUE;
|
||||||
|
|
||||||
update_timer(p);
|
update_timer(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -533,7 +532,7 @@ void pa_rtpoll_set_timer_disabled(pa_rtpoll *p) {
|
||||||
|
|
||||||
pa_rtpoll_item *pa_rtpoll_item_new(pa_rtpoll *p, pa_rtpoll_priority_t prio, unsigned n_fds) {
|
pa_rtpoll_item *pa_rtpoll_item_new(pa_rtpoll *p, pa_rtpoll_priority_t prio, unsigned n_fds) {
|
||||||
pa_rtpoll_item *i, *j, *l = NULL;
|
pa_rtpoll_item *i, *j, *l = NULL;
|
||||||
|
|
||||||
pa_assert(p);
|
pa_assert(p);
|
||||||
|
|
||||||
if (!(i = pa_flist_pop(PA_STATIC_FLIST_GET(items))))
|
if (!(i = pa_flist_pop(PA_STATIC_FLIST_GET(items))))
|
||||||
|
|
@ -582,20 +581,20 @@ void pa_rtpoll_item_free(pa_rtpoll_item *i) {
|
||||||
struct pollfd *pa_rtpoll_item_get_pollfd(pa_rtpoll_item *i, unsigned *n_fds) {
|
struct pollfd *pa_rtpoll_item_get_pollfd(pa_rtpoll_item *i, unsigned *n_fds) {
|
||||||
pa_assert(i);
|
pa_assert(i);
|
||||||
|
|
||||||
if (i->n_pollfd > 0)
|
if (i->n_pollfd > 0)
|
||||||
if (i->rtpoll->rebuild_needed)
|
if (i->rtpoll->rebuild_needed)
|
||||||
rtpoll_rebuild(i->rtpoll);
|
rtpoll_rebuild(i->rtpoll);
|
||||||
|
|
||||||
if (n_fds)
|
if (n_fds)
|
||||||
*n_fds = i->n_pollfd;
|
*n_fds = i->n_pollfd;
|
||||||
|
|
||||||
return i->pollfd;
|
return i->pollfd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pa_rtpoll_item_set_before_callback(pa_rtpoll_item *i, int (*before_cb)(pa_rtpoll_item *i)) {
|
void pa_rtpoll_item_set_before_callback(pa_rtpoll_item *i, int (*before_cb)(pa_rtpoll_item *i)) {
|
||||||
pa_assert(i);
|
pa_assert(i);
|
||||||
pa_assert(i->priority < PA_RTPOLL_NEVER);
|
pa_assert(i->priority < PA_RTPOLL_NEVER);
|
||||||
|
|
||||||
i->before_cb = before_cb;
|
i->before_cb = before_cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -635,7 +634,7 @@ static int fdsem_before(pa_rtpoll_item *i) {
|
||||||
|
|
||||||
static void fdsem_after(pa_rtpoll_item *i) {
|
static void fdsem_after(pa_rtpoll_item *i) {
|
||||||
pa_assert(i);
|
pa_assert(i);
|
||||||
|
|
||||||
pa_assert((i->pollfd[0].revents & ~POLLIN) == 0);
|
pa_assert((i->pollfd[0].revents & ~POLLIN) == 0);
|
||||||
pa_fdsem_after_poll(i->userdata);
|
pa_fdsem_after_poll(i->userdata);
|
||||||
}
|
}
|
||||||
|
|
@ -643,7 +642,7 @@ static void fdsem_after(pa_rtpoll_item *i) {
|
||||||
pa_rtpoll_item *pa_rtpoll_item_new_fdsem(pa_rtpoll *p, pa_rtpoll_priority_t prio, pa_fdsem *f) {
|
pa_rtpoll_item *pa_rtpoll_item_new_fdsem(pa_rtpoll *p, pa_rtpoll_priority_t prio, pa_fdsem *f) {
|
||||||
pa_rtpoll_item *i;
|
pa_rtpoll_item *i;
|
||||||
struct pollfd *pollfd;
|
struct pollfd *pollfd;
|
||||||
|
|
||||||
pa_assert(p);
|
pa_assert(p);
|
||||||
pa_assert(f);
|
pa_assert(f);
|
||||||
|
|
||||||
|
|
@ -653,7 +652,7 @@ pa_rtpoll_item *pa_rtpoll_item_new_fdsem(pa_rtpoll *p, pa_rtpoll_priority_t prio
|
||||||
|
|
||||||
pollfd->fd = pa_fdsem_get(f);
|
pollfd->fd = pa_fdsem_get(f);
|
||||||
pollfd->events = POLLIN;
|
pollfd->events = POLLIN;
|
||||||
|
|
||||||
i->before_cb = fdsem_before;
|
i->before_cb = fdsem_before;
|
||||||
i->after_cb = fdsem_after;
|
i->after_cb = fdsem_after;
|
||||||
i->userdata = f;
|
i->userdata = f;
|
||||||
|
|
@ -663,7 +662,7 @@ pa_rtpoll_item *pa_rtpoll_item_new_fdsem(pa_rtpoll *p, pa_rtpoll_priority_t prio
|
||||||
|
|
||||||
static int asyncmsgq_before(pa_rtpoll_item *i) {
|
static int asyncmsgq_before(pa_rtpoll_item *i) {
|
||||||
pa_assert(i);
|
pa_assert(i);
|
||||||
|
|
||||||
if (pa_asyncmsgq_before_poll(i->userdata) < 0)
|
if (pa_asyncmsgq_before_poll(i->userdata) < 0)
|
||||||
return 1; /* 1 means immediate restart of the loop */
|
return 1; /* 1 means immediate restart of the loop */
|
||||||
|
|
||||||
|
|
@ -672,7 +671,7 @@ static int asyncmsgq_before(pa_rtpoll_item *i) {
|
||||||
|
|
||||||
static void asyncmsgq_after(pa_rtpoll_item *i) {
|
static void asyncmsgq_after(pa_rtpoll_item *i) {
|
||||||
pa_assert(i);
|
pa_assert(i);
|
||||||
|
|
||||||
pa_assert((i->pollfd[0].revents & ~POLLIN) == 0);
|
pa_assert((i->pollfd[0].revents & ~POLLIN) == 0);
|
||||||
pa_asyncmsgq_after_poll(i->userdata);
|
pa_asyncmsgq_after_poll(i->userdata);
|
||||||
}
|
}
|
||||||
|
|
@ -688,7 +687,7 @@ static int asyncmsgq_work(pa_rtpoll_item *i) {
|
||||||
|
|
||||||
if (pa_asyncmsgq_get(i->userdata, &object, &code, &data, &offset, &chunk, 0) == 0) {
|
if (pa_asyncmsgq_get(i->userdata, &object, &code, &data, &offset, &chunk, 0) == 0) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!object && code == PA_MESSAGE_SHUTDOWN) {
|
if (!object && code == PA_MESSAGE_SHUTDOWN) {
|
||||||
pa_asyncmsgq_done(i->userdata, 0);
|
pa_asyncmsgq_done(i->userdata, 0);
|
||||||
pa_rtpoll_quit(i->rtpoll);
|
pa_rtpoll_quit(i->rtpoll);
|
||||||
|
|
@ -698,7 +697,7 @@ static int asyncmsgq_work(pa_rtpoll_item *i) {
|
||||||
ret = pa_asyncmsgq_dispatch(object, code, data, offset, &chunk);
|
ret = pa_asyncmsgq_dispatch(object, code, data, offset, &chunk);
|
||||||
pa_asyncmsgq_done(i->userdata, ret);
|
pa_asyncmsgq_done(i->userdata, ret);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -706,7 +705,7 @@ static int asyncmsgq_work(pa_rtpoll_item *i) {
|
||||||
pa_rtpoll_item *pa_rtpoll_item_new_asyncmsgq(pa_rtpoll *p, pa_rtpoll_priority_t prio, pa_asyncmsgq *q) {
|
pa_rtpoll_item *pa_rtpoll_item_new_asyncmsgq(pa_rtpoll *p, pa_rtpoll_priority_t prio, pa_asyncmsgq *q) {
|
||||||
pa_rtpoll_item *i;
|
pa_rtpoll_item *i;
|
||||||
struct pollfd *pollfd;
|
struct pollfd *pollfd;
|
||||||
|
|
||||||
pa_assert(p);
|
pa_assert(p);
|
||||||
pa_assert(q);
|
pa_assert(q);
|
||||||
|
|
||||||
|
|
@ -715,7 +714,7 @@ pa_rtpoll_item *pa_rtpoll_item_new_asyncmsgq(pa_rtpoll *p, pa_rtpoll_priority_t
|
||||||
pollfd = pa_rtpoll_item_get_pollfd(i, NULL);
|
pollfd = pa_rtpoll_item_get_pollfd(i, NULL);
|
||||||
pollfd->fd = pa_asyncmsgq_get_fd(q);
|
pollfd->fd = pa_asyncmsgq_get_fd(q);
|
||||||
pollfd->events = POLLIN;
|
pollfd->events = POLLIN;
|
||||||
|
|
||||||
i->before_cb = asyncmsgq_before;
|
i->before_cb = asyncmsgq_before;
|
||||||
i->after_cb = asyncmsgq_after;
|
i->after_cb = asyncmsgq_after;
|
||||||
i->work_cb = asyncmsgq_work;
|
i->work_cb = asyncmsgq_work;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue