mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
mainloop fixes: when disabling time events when dispatching them, make sure to adjust the cache time event and enabled time event counters
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1153 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
b2ad9a9753
commit
0d7be3148e
2 changed files with 12 additions and 2 deletions
|
|
@ -573,7 +573,10 @@ static gboolean dispatch_func(GSource *source, PA_GCC_UNUSED GSourceFunc callbac
|
||||||
tvnow.tv_usec = now.tv_usec;
|
tvnow.tv_usec = now.tv_usec;
|
||||||
|
|
||||||
if (pa_timeval_cmp(&t->timeval, &tvnow) <= 0) {
|
if (pa_timeval_cmp(&t->timeval, &tvnow) <= 0) {
|
||||||
t->enabled = 0;
|
|
||||||
|
/* Disable time event */
|
||||||
|
glib_time_restart(t, NULL);
|
||||||
|
|
||||||
t->callback(&g->api, t, &t->timeval, t->userdata);
|
t->callback(&g->api, t, &t->timeval, t->userdata);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -635,6 +638,8 @@ pa_glib_mainloop *pa_glib_mainloop_new(GMainContext *c) {
|
||||||
g->n_enabled_defer_events = g->n_enabled_time_events = 0;
|
g->n_enabled_defer_events = g->n_enabled_time_events = 0;
|
||||||
g->io_events_please_scan = g->time_events_please_scan = g->defer_events_please_scan = 0;
|
g->io_events_please_scan = g->time_events_please_scan = g->defer_events_please_scan = 0;
|
||||||
|
|
||||||
|
g->cached_next_time_event = NULL;
|
||||||
|
|
||||||
g_source_attach(&g->source, g->context);
|
g_source_attach(&g->source, g->context);
|
||||||
g_source_set_can_recurse(&g->source, FALSE);
|
g_source_set_can_recurse(&g->source, FALSE);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -766,7 +766,12 @@ static int dispatch_timeout(pa_mainloop *m) {
|
||||||
if (pa_timeval_cmp(&e->timeval, &now) <= 0) {
|
if (pa_timeval_cmp(&e->timeval, &now) <= 0) {
|
||||||
assert(e->callback);
|
assert(e->callback);
|
||||||
|
|
||||||
e->enabled = 0;
|
/* Disable time event */
|
||||||
|
mainloop_time_restart(e, NULL);
|
||||||
|
|
||||||
|
if (m->cached_next_time_event == e)
|
||||||
|
m->cached_next_time_event = NULL;
|
||||||
|
|
||||||
e->callback(&m->api, e, &e->timeval, e->userdata);
|
e->callback(&m->api, e, &e->timeval, e->userdata);
|
||||||
|
|
||||||
r++;
|
r++;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue