glibcompat: add replacement for g_cond_wait_until().
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 12 Sep 2012 11:42:49 +0000 (13:42 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 12 Sep 2012 11:42:49 +0000 (13:42 +0200)
gst-libs/gst/vaapi/glibcompat.h

index 30a8563..0a6115c 100644 (file)
@@ -74,4 +74,18 @@ g_clear_object_inline(volatile GObject **object_ptr)
 #define g_static_rec_mutex_unlock(m)    g_rec_mutex_unlock(m)
 #endif
 
+#if !GLIB_CHECK_VERSION(2,31,2)
+static inline gboolean
+g_cond_wait_until(GCond *cond, GMutex *mutex, gint64 end_time)
+{
+    gint64 diff_time;
+    GTimeVal timeout;
+
+    diff_time = end_time - g_get_monotonic_time();
+    g_get_current_time(&timeout);
+    g_time_val_add(&timeout, diff_time > 0 ? diff_time : 0);
+    return g_cond_timed_wait(cond, mutex, &timeout);
+}
+#endif
+
 #endif /* GLIB_COMPAT_H */