From 30dcfe4d336c86f29bd66ff11c2eaf18a318a728 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 8 Nov 2012 08:30:22 -0500 Subject: [PATCH] Restore e_flag_timed_wait(). 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 | 2 +- .../libedataserver/libedataserver-sections.txt | 3 +- libedataserver/e-flag.c | 38 ++++++++++++++++++++++ libedataserver/e-flag.h | 5 +++ 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index f1d9dd3..ab319f8 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/docs/reference/libedataserver/libedataserver-sections.txt b/docs/reference/libedataserver/libedataserver-sections.txt index fd2df4c..b39afd5 100644 --- a/docs/reference/libedataserver/libedataserver-sections.txt +++ b/docs/reference/libedataserver/libedataserver-sections.txt @@ -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
diff --git a/libedataserver/e-flag.c b/libedataserver/e-flag.c index 05008e4..55c097d 100644 --- a/libedataserver/e-flag.c +++ b/libedataserver/e-flag.c @@ -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 diff --git a/libedataserver/e-flag.h b/libedataserver/e-flag.h index 43d4aaa..30e2e1c 100644 --- a/libedataserver/e-flag.h +++ b/libedataserver/e-flag.h @@ -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 */ -- 2.7.4