Use g_cond_wait_until() instead of g_cond_timed_wait()
authorPhilip Chimento <philip.chimento@gmail.com>
Sat, 31 Aug 2013 21:00:15 +0000 (14:00 -0700)
committerPhilip Chimento <philip.chimento@gmail.com>
Mon, 9 Sep 2013 04:12:01 +0000 (21:12 -0700)
This bumps the GLib version requirement to 2.32; that is also the
version in which g_cond_timed_wait() was deprecated.

configure.ac
libchimara/event.c

index 54b947f25e9ddbf4a68d3992fd15afff55322b93..fb6bec56cd453b67ace0925a2d2849a95a4fdb56 100644 (file)
@@ -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)
index 7c916c073b5b8e4eef94b41dd387389f876c653c..dd348a960325836ff8c2174f3a710bf0575ce752 100644 (file)
@@ -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;
                }