summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-07-26 22:39:06 +0000
committerLennart Poettering <lennart@poettering.net>2006-07-26 22:39:06 +0000
commit0d7be3148e872d0d2a68ecd740a596a3bcf4db5a (patch)
tree5217e6897d4e745713a92631925a5208dc9aeaa3
parentb2ad9a9753d9d5e69192a620b714f7e32a31e574 (diff)
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
-rw-r--r--src/pulse/glib-mainloop.c7
-rw-r--r--src/pulse/mainloop.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/src/pulse/glib-mainloop.c b/src/pulse/glib-mainloop.c
index 76767552..201b6e23 100644
--- a/src/pulse/glib-mainloop.c
+++ b/src/pulse/glib-mainloop.c
@@ -573,7 +573,10 @@ static gboolean dispatch_func(GSource *source, PA_GCC_UNUSED GSourceFunc callbac
tvnow.tv_usec = now.tv_usec;
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);
return TRUE;
}
@@ -634,6 +637,8 @@ pa_glib_mainloop *pa_glib_mainloop_new(GMainContext *c) {
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->cached_next_time_event = NULL;
g_source_attach(&g->source, g->context);
g_source_set_can_recurse(&g->source, FALSE);
diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c
index 682b2ccd..699c0ee7 100644
--- a/src/pulse/mainloop.c
+++ b/src/pulse/mainloop.c
@@ -766,7 +766,12 @@ static int dispatch_timeout(pa_mainloop *m) {
if (pa_timeval_cmp(&e->timeval, &now) <= 0) {
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);
r++;