Restore e_flag_timed_wait().
authorMatthew Barnes <mbarnes@redhat.com>
Thu, 8 Nov 2012 13:30:22 +0000 (08:30 -0500)
committerMatthew Barnes <mbarnes@redhat.com>
Thu, 8 Nov 2012 13:34:06 +0000 (08:34 -0500)
Just deprecate the function, don't delete it.  GTimeVal isn't going
away any time soon.  It's not worth a libedataserver soname bump.

configure.ac
docs/reference/libedataserver/libedataserver-sections.txt
libedataserver/e-flag.c
libedataserver/e-flag.h

index f1d9dd3..ab319f8 100644 (file)
@@ -87,7 +87,7 @@ AC_SUBST(SOURCES_DBUS_SERVICE_NAME)
 dnl ******************************
 dnl Libtool versioning
 dnl ******************************
-LIBEDATASERVER_CURRENT=18
+LIBEDATASERVER_CURRENT=17
 LIBEDATASERVER_REVISION=0
 LIBEDATASERVER_AGE=0
 
index fd2df4c..b39afd5 100644 (file)
@@ -128,8 +128,9 @@ e_flag_is_set
 e_flag_set
 e_flag_clear
 e_flag_wait
-e_flag_timed_wait
+e_flag_wait_until
 e_flag_free
+e_flag_timed_wait
 </SECTION>
 
 <SECTION>
index 05008e4..55c097d 100644 (file)
@@ -132,6 +132,44 @@ e_flag_wait (EFlag *flag)
 }
 
 /**
+ * e_flag_timed_wait:
+ * @flag: an #EFlag
+ * @abs_time: a #GTimeVal, determining the final time
+ *
+ * Blocks until @flag is set, or until the time specified by @abs_time.
+ * If @flag is already set, the function returns immediately.  The return
+ * value indicates the state of @flag after waiting.
+ *
+ * If @abs_time is %NULL, e_flag_timed_wait() acts like e_flag_wait().
+ *
+ * To easily calculate @abs_time, a combination of g_get_current_time() and
+ * g_time_val_add() can be used.
+ *
+ * Returns: %TRUE if @flag is now set
+ *
+ * Since: 1.12
+ *
+ * Deprecated: 3.8: Use e_flag_wait_until() instead.
+ **/
+gboolean
+e_flag_timed_wait (EFlag *flag,
+                   GTimeVal *abs_time)
+{
+       gboolean is_set;
+
+       g_return_val_if_fail (flag != NULL, FALSE);
+
+       g_mutex_lock (&flag->mutex);
+       while (!flag->is_set)
+               if (!g_cond_timed_wait (&flag->cond, &flag->mutex, abs_time))
+                       break;
+       is_set = flag->is_set;
+       g_mutex_unlock (&flag->mutex);
+
+       return is_set;
+}
+
+/**
  * e_flag_wait_until:
  * @flag: an #EFlag
  * @end_time: the monotonic time to wait until
index 43d4aaa..30e2e1c 100644 (file)
@@ -50,6 +50,11 @@ gboolean     e_flag_wait_until               (EFlag *flag,
                                                 gint64 end_time);
 void           e_flag_free                     (EFlag *flag);
 
+#ifndef EDS_DISABLE_DEPRECATED
+gboolean       e_flag_timed_wait               (EFlag *flag,
+                                                GTimeVal *abs_time);
+#endif /* EDS_DISABLE_DEPRECATED */
+
 G_END_DECLS
 
 #endif /* E_FLAG_H */