summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-07-22 00:54:23 +0000
committerLennart Poettering <lennart@poettering.net>2006-07-22 00:54:23 +0000
commit07a1c45cc1bd647d9a9c579a0c2bffd4c3d5fc1b (patch)
treeb699b24fd0ce91a2a169d2b36905b23ba4b83d8f /src
parentb345af2273cdeee77785514974e5c5b28ebb5fe3 (diff)
fix horribly broken glib timeout event handling
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1138 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src')
-rw-r--r--src/pulse/glib-mainloop.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/pulse/glib-mainloop.c b/src/pulse/glib-mainloop.c
index cdaecdf83..77f934501 100644
--- a/src/pulse/glib-mainloop.c
+++ b/src/pulse/glib-mainloop.c
@@ -312,7 +312,7 @@ static void glib_time_restart(pa_time_event*e, const struct timeval *tv) {
assert(e);
assert(!e->dead);
- if (e->enabled && !!tv)
+ if (e->enabled && !tv)
e->mainloop->n_enabled_time_events--;
else if (!e->enabled && tv)
e->mainloop->n_enabled_time_events++;
@@ -476,13 +476,11 @@ static gboolean prepare_func(GSource *source, gint *timeout) {
tvnow.tv_sec = now.tv_sec;
tvnow.tv_usec = now.tv_usec;
- usec = pa_timeval_diff(&t->timeval, &tvnow);
-
- if (usec <= 0) {
+ if (pa_timeval_cmp(&t->timeval, &tvnow) <= 0) {
*timeout = 0;
return TRUE;
- }
-
+ }
+ usec = pa_timeval_diff(&t->timeval, &tvnow);
*timeout = (gint) (usec / 1000);
} else
*timeout = -1;
@@ -554,7 +552,7 @@ static gboolean dispatch_func(GSource *source, PA_GCC_UNUSED GSourceFunc callbac
tvnow.tv_sec = now.tv_sec;
tvnow.tv_usec = now.tv_usec;
- if (pa_timeval_cmp(&t->timeval, &tvnow) < 0) {
+ if (pa_timeval_cmp(&t->timeval, &tvnow) <= 0) {
t->callback(&g->api, t, &t->timeval, t->userdata);
return TRUE;
}