From fabdd6909a49dcf126b066bc37475b81754b58a7 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Sat, 31 Aug 2013 14:00:15 -0700 Subject: [PATCH] Use g_cond_wait_until() instead of g_cond_timed_wait() This bumps the GLib version requirement to 2.32; that is also the version in which g_cond_timed_wait() was deprecated. --- configure.ac | 2 +- libchimara/event.c | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 54b947f..fb6bec5 100644 --- a/configure.ac +++ b/configure.ac @@ -27,7 +27,7 @@ AC_SUBST(LT_VERSION_INFO) ### REQUIREMENTS ############################################################## GTK_REQUIRED_VERSION=3.2 -GLIB_REQUIRED_VERSION=2.16 +GLIB_REQUIRED_VERSION=2.32 GTK_DOC_REQUIRED_VERSION=1.12 AC_SUBST(GTK_REQUIRED_VERSION) AC_SUBST(GLIB_REQUIRED_VERSION) diff --git a/libchimara/event.c b/libchimara/event.c index 7c916c0..dd348a9 100644 --- a/libchimara/event.c +++ b/libchimara/event.c @@ -23,17 +23,15 @@ event_throw(ChimaraGlk *glk, glui32 type, winid_t win, glui32 val1, glui32 val2) if(!priv->event_queue) return; - GTimeVal timeout; - g_get_current_time(&timeout); - g_time_val_add(&timeout, EVENT_TIMEOUT_MICROSECONDS); + gint64 timeout = g_get_monotonic_time() + EVENT_TIMEOUT_MICROSECONDS; g_mutex_lock(&priv->event_lock); /* Wait for room in the event queue */ while( g_queue_get_length(priv->event_queue) >= EVENT_QUEUE_MAX_LENGTH ) - if( !g_cond_timed_wait(&priv->event_queue_not_full, &priv->event_lock, &timeout) ) + if( !g_cond_wait_until(&priv->event_queue_not_full, &priv->event_lock, timeout) ) { - /* Drop the event after 3 seconds */ + /* Drop the event if the event queue is still not emptying */ g_mutex_unlock(&priv->event_lock); return; } -- 2.30.2