[maemo-commits] [maemo-commits] r18333 - in projects/haf/branches/glib/glib-2-20/debian: . patches
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Tue May 12 15:02:45 EEST 2009
- Previous message: [maemo-commits] r18332 - projects/haf/trunk/hildon-thumbnail/daemon
- Next message: [maemo-commits] r18334 - projects/haf/trunk/hildon-thumbnail/daemon
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: csaavedra Date: 2009-05-12 15:02:12 +0300 (Tue, 12 May 2009) New Revision: 18333 Added: projects/haf/branches/glib/glib-2-20/debian/patches/70_use-monotonic-clock-for-timeouts.patch Modified: projects/haf/branches/glib/glib-2-20/debian/changelog projects/haf/branches/glib/glib-2-20/debian/patches/series Log: * 70_use-monotonic-clock-for-timeouts.patch: new patch. Fixes: NB#115307 (Glib should use monotonic clock for timeouts) Modified: projects/haf/branches/glib/glib-2-20/debian/changelog =================================================================== --- projects/haf/branches/glib/glib-2-20/debian/changelog 2009-05-12 11:59:47 UTC (rev 18332) +++ projects/haf/branches/glib/glib-2-20/debian/changelog 2009-05-12 12:02:12 UTC (rev 18333) @@ -9,8 +9,10 @@ * Drop patches applied upstream: + 20-gunixmount.patch, dropped. + 55-gsignal.patch, dropped. + * 70_use-monotonic-clock-for-timeouts.patch: new patch. + Fixes: NB#115307 (Glib should use monotonic clock for timeouts) - -- Claudio Saavedra <csaavedra at igalia.com> Thu, 07 May 2009 14:03:16 +0300 + -- Claudio Saavedra <csaavedra at igalia.com> Tue, 12 May 2009 14:51:17 +0300 glib2.0 (2.20.1-1) unstable; urgency=low Added: projects/haf/branches/glib/glib-2-20/debian/patches/70_use-monotonic-clock-for-timeouts.patch =================================================================== --- projects/haf/branches/glib/glib-2-20/debian/patches/70_use-monotonic-clock-for-timeouts.patch 2009-05-12 11:59:47 UTC (rev 18332) +++ projects/haf/branches/glib/glib-2-20/debian/patches/70_use-monotonic-clock-for-timeouts.patch 2009-05-12 12:02:12 UTC (rev 18333) @@ -0,0 +1,169 @@ +diff --git a/configure.in b/configure.in +index 32d6561..21d617b 100644 +--- a/configure.in ++++ b/configure.in +@@ -2345,6 +2345,7 @@ AC_CHECK_FUNCS(clock_gettime, [], [ + AC_DEFINE(HAVE_CLOCK_GETTIME, 1) + G_THREAD_LIBS="$G_THREAD_LIBS -lrt" + G_THREAD_LIBS_FOR_GTHREAD="$G_THREAD_LIBS_FOR_GTHREAD -lrt" ++ G_LIBS_EXTRA="$G_LIBS_EXTRA -lrt" + ]) + ]) + +@@ -2611,13 +2612,13 @@ dnl ********************** + + case $host in + *-*-cygwin*) +- G_LIBS_EXTRA="-luser32 -lkernel32" ++ G_LIBS_EXTRA="$G_LIBS_EXTRA -luser32 -lkernel32" + ;; + *-*-mingw*) +- G_LIBS_EXTRA="-lws2_32 -lole32" ++ G_LIBS_EXTRA="$G_LIBS_EXTRA -lws2_32 -lole32" + ;; + *) +- G_LIBS_EXTRA="" ++ G_LIBS_EXTRA="$G_LIBS_EXTRA" + ;; + esac + AC_SUBST(G_LIBS_EXTRA) +diff --git a/glib/gmain.c b/glib/gmain.c +index 17866c7..a0d3a77 100644 +--- a/glib/gmain.c ++++ b/glib/gmain.c +@@ -77,6 +77,10 @@ + + #include "galias.h" + ++#if defined(HAVE_CLOCK_GETTIME) && defined(HAVE_MONOTONIC_CLOCK) ++#define USE_CLOCK_GETTIME 1 ++#endif ++ + /* Types */ + + typedef struct _GTimeoutSource GTimeoutSource; +@@ -158,6 +162,7 @@ struct _GMainContext + GPollFunc poll_func; + + GTimeVal current_time; ++ GTimeVal current_time_monotonic; + gboolean time_is_current; + }; + +@@ -229,6 +234,9 @@ struct _GPollRec + + /* Forward declarations */ + ++static void g_get_current_time_monotonic (GTimeVal *result); ++static void g_source_get_current_time_monotonic (GSource *source, ++ GTimeVal *timeval); + static void g_source_unref_internal (GSource *source, + GMainContext *context, + gboolean have_lock); +@@ -1477,6 +1485,20 @@ g_get_current_time (GTimeVal *result) + } + + static void ++g_get_current_time_monotonic (GTimeVal *result) ++{ ++#ifdef USE_CLOCK_GETTIME ++ struct timespec r; ++ ++ clock_gettime (CLOCK_MONOTONIC, &r); ++ result->tv_sec = r.tv_sec; ++ result->tv_usec = r.tv_nsec / 1000; ++#else ++ g_get_current_time (result); ++#endif ++} ++ ++static void + g_main_dispatch_free (gpointer dispatch) + { + g_slice_free (GMainDispatch, dispatch); +@@ -2968,6 +2990,7 @@ g_source_get_current_time (GSource *source, + if (!context->time_is_current) + { + g_get_current_time (&context->current_time); ++ g_get_current_time_monotonic (&context->current_time_monotonic); + context->time_is_current = TRUE; + } + +@@ -2976,6 +2999,30 @@ g_source_get_current_time (GSource *source, + UNLOCK_CONTEXT (context); + } + ++static void ++g_source_get_current_time_monotonic (GSource *source, ++ GTimeVal *timeval) ++{ ++ GMainContext *context; ++ ++ g_return_if_fail (source->context != NULL); ++ ++ context = source->context; ++ ++ LOCK_CONTEXT (context); ++ ++ if (!context->time_is_current) ++ { ++ g_get_current_time (&context->current_time); ++ g_get_current_time_monotonic (&context->current_time_monotonic); ++ context->time_is_current = TRUE; ++ } ++ ++ *timeval = context->current_time_monotonic; ++ ++ UNLOCK_CONTEXT (context); ++} ++ + /** + * g_main_context_set_poll_func: + * @context: a #GMainContext +@@ -3180,7 +3227,7 @@ g_timeout_prepare (GSource *source, + + GTimeoutSource *timeout_source = (GTimeoutSource *)source; + +- g_source_get_current_time (source, ¤t_time); ++ g_source_get_current_time_monotonic (source, ¤t_time); + + sec = timeout_source->expiration.tv_sec - current_time.tv_sec; + msec = (timeout_source->expiration.tv_usec - current_time.tv_usec) / 1000; +@@ -3229,8 +3276,8 @@ g_timeout_check (GSource *source) + GTimeVal current_time; + GTimeoutSource *timeout_source = (GTimeoutSource *)source; + +- g_source_get_current_time (source, ¤t_time); +- ++ g_source_get_current_time_monotonic (source, ¤t_time); ++ + return ((timeout_source->expiration.tv_sec < current_time.tv_sec) || + ((timeout_source->expiration.tv_sec == current_time.tv_sec) && + (timeout_source->expiration.tv_usec <= current_time.tv_usec))); +@@ -3254,7 +3301,7 @@ g_timeout_dispatch (GSource *source, + { + GTimeVal current_time; + +- g_source_get_current_time (source, ¤t_time); ++ g_source_get_current_time_monotonic (source, ¤t_time); + g_timeout_set_expiration (timeout_source, ¤t_time); + + return TRUE; +@@ -3284,7 +3331,7 @@ g_timeout_source_new (guint interval) + + timeout_source->interval = interval; + +- g_get_current_time (¤t_time); ++ g_get_current_time_monotonic (¤t_time); + g_timeout_set_expiration (timeout_source, ¤t_time); + + return source; +@@ -3317,7 +3364,7 @@ g_timeout_source_new_seconds (guint interval) + timeout_source->interval = 1000*interval; + timeout_source->granularity = 1000; + +- g_get_current_time (¤t_time); ++ g_get_current_time_monotonic (¤t_time); + g_timeout_set_expiration (timeout_source, ¤t_time); + + return source; Property changes on: projects/haf/branches/glib/glib-2-20/debian/patches/70_use-monotonic-clock-for-timeouts.patch ___________________________________________________________________ Name: svn:mergeinfo + Modified: projects/haf/branches/glib/glib-2-20/debian/patches/series =================================================================== --- projects/haf/branches/glib/glib-2-20/debian/patches/series 2009-05-12 11:59:47 UTC (rev 18332) +++ projects/haf/branches/glib/glib-2-20/debian/patches/series 2009-05-12 12:02:12 UTC (rev 18333) @@ -5,3 +5,4 @@ 40-gscanner.patch 45-gunicode.patch 50-gthread.patch +70_use-monotonic-clock-for-timeouts.patch
- Previous message: [maemo-commits] r18332 - projects/haf/trunk/hildon-thumbnail/daemon
- Next message: [maemo-commits] r18334 - projects/haf/trunk/hildon-thumbnail/daemon
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]