[glib/wip/glib-next] GMainLoop: remove wall clock time cache
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/glib-next] GMainLoop: remove wall clock time cache
- Date: Thu, 1 Sep 2011 03:38:42 +0000 (UTC)
commit f5a67adb8a7b1e7aa7c28f635c7c483c0126ff63
Author: Ryan Lortie <desrt desrt ca>
Date: Tue Aug 30 13:32:58 2011 -0400
GMainLoop: remove wall clock time cache
Since GMainLoop is now purely monotonic, it really doesn't make sense to
cache the wallclock time just for the sake of making a deprecated call
more efficient.
glib/gmain.c | 37 +++++--------------------------------
1 files changed, 5 insertions(+), 32 deletions(-)
---
diff --git a/glib/gmain.c b/glib/gmain.c
index 25c2e3b..81663a8 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -247,8 +247,6 @@ struct _GMainContext
gint64 time;
gboolean time_is_fresh;
- gint64 real_time;
- gboolean real_time_is_fresh;
};
struct _GSourceCallback
@@ -558,7 +556,6 @@ g_main_context_new (void)
context->pending_dispatches = g_ptr_array_new ();
context->time_is_fresh = FALSE;
- context->real_time_is_fresh = FALSE;
g_main_context_init_pipe (context);
@@ -2609,7 +2606,6 @@ g_main_context_prepare (GMainContext *context,
LOCK_CONTEXT (context);
context->time_is_fresh = FALSE;
- context->real_time_is_fresh = FALSE;
if (context->in_check_or_prepare)
{
@@ -2778,10 +2774,7 @@ g_main_context_query (GMainContext *context,
{
*timeout = context->timeout;
if (*timeout != 0)
- {
- context->time_is_fresh = FALSE;
- context->real_time_is_fresh = FALSE;
- }
+ context->time_is_fresh = FALSE;
}
UNLOCK_CONTEXT (context);
@@ -3488,12 +3481,9 @@ g_main_context_remove_poll_unlocked (GMainContext *context,
* g_source_get_current_time:
* @source: a #GSource
* @timeval: #GTimeVal structure in which to store current time.
- *
- * Gets the "current time" to be used when checking
- * this source. The advantage of calling this function over
- * calling g_get_current_time() directly is that when
- * checking multiple sources, GLib can cache a single value
- * instead of having to repeatedly get the system time.
+ *
+ * This function ignores @source and is otherwise the same as
+ * g_get_current_time().
*
* Deprecated: 2.28: use g_source_get_time() instead
**/
@@ -3501,24 +3491,7 @@ void
g_source_get_current_time (GSource *source,
GTimeVal *timeval)
{
- GMainContext *context;
-
- g_return_if_fail (source->context != NULL);
-
- context = source->context;
-
- LOCK_CONTEXT (context);
-
- if (!context->real_time_is_fresh)
- {
- context->real_time = g_get_real_time ();
- context->real_time_is_fresh = TRUE;
- }
-
- timeval->tv_sec = context->real_time / 1000000;
- timeval->tv_usec = context->real_time % 1000000;
-
- UNLOCK_CONTEXT (context);
+ g_get_current_time (timeval);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]