Revert an accidental ABI break by moving gettime out of the
authorMatthias Clasen <mclasen@redhat.com>
Tue, 16 Jan 2007 21:25:03 +0000 (21:25 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 16 Jan 2007 21:25:03 +0000 (21:25 +0000)
2007-01-16  Matthias Clasen  <mclasen@redhat.com>

        * glib/gthread.h:
        * glib/gthread.c:
        * glib/glib.symbols: Revert an accidental ABI break by
        moving gettime out of the GThreadFunctions struct and making
        it a separate variable.  (#397139, Joe Marcus Clarke)

        * gthread/*.c: Adapt.

svn path=/trunk/; revision=5279

ChangeLog
glib/glib.symbols
glib/gthread.c
glib/gthread.h
glib/gtimer.c
gthread/gthread-impl.c
gthread/gthread-none.c
gthread/gthread-posix.c
gthread/gthread-win32.c

index aa1993e9465e831d9421614f22655f267e5d5b94..baab6605498a25264b8285dd659d86239d467146 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-01-16  Matthias Clasen  <mclasen@redhat.com>
+
+       * glib/gthread.h:
+       * glib/gthread.c:
+       * glib/glib.symbols: Revert an accidental ABI break by
+       moving gettime out of the GThreadFunctions struct and making
+       it a separate variable.  (#397139, Joe Marcus Clarke)
+
+       * gthread/*.c: Adapt.
+
 2007-01-16  Tor Lillqvist  <tml@novell.com>
 
        * glib/gthread.c (gettime): GetSystemTimeAsFileTime() returns 100s
index 2649bd40909ee8765a6e8a7e17c13ce327d836be..9c1aeae9d21ab3532616870c7c61d8fbc59c0581 100644 (file)
@@ -1127,6 +1127,7 @@ g_thread_init_glib
 g_thread_functions_for_glib_use
 g_threads_got_initialized
 g_thread_use_default_impl
+g_thread_gettime
 #endif
 g_thread_create_full
 g_thread_error_quark
index 116c2af25e9de6457ae116324dc06d60b0d9438d..81df421afa07a18406913f4b46188859db88353f 100644 (file)
@@ -80,6 +80,8 @@ static void    g_thread_cleanup (gpointer data);
 static void    g_thread_fail (void);
 static guint64 gettime (void);
 
+guint64        (*g_thread_gettime) (void) = gettime;
+
 /* Global variables */
 
 static GSystemThread zero_thread; /* This is initialized to all zero */
@@ -108,9 +110,8 @@ GThreadFunctions g_thread_functions_for_glib_use = {
   NULL,                                        /* thread_join */
   NULL,                                        /* thread_exit */
   NULL,                                        /* thread_set_priority */
-  NULL,                                         /* thread_self */
-  NULL,                                         /* thread_equal */
-  gettime                                      /* gettime */
+  NULL,                                        /* thread_self */
+  NULL                                         /* thread_equal */
 };
 
 /* Local data */
index e6f1389fba05d9a08c2cc097d474a041073b97c2..79099f17352d69c460107918ce09ee08ce69af2d 100644 (file)
@@ -106,13 +106,14 @@ struct _GThreadFunctions
   void      (*thread_self)        (gpointer              thread);
   gboolean  (*thread_equal)       (gpointer              thread1,
                                   gpointer              thread2);
-  guint64   (*gettime)            (void);
 };
 
 GLIB_VAR GThreadFunctions       g_thread_functions_for_glib_use;
 GLIB_VAR gboolean               g_thread_use_default_impl;
 GLIB_VAR gboolean               g_threads_got_initialized;
 
+GLIB_VAR guint64   (*g_thread_gettime) (void);
+
 /* initializes the mutex/cond/private implementation for glib, might
  * only be called once, and must not be called directly or indirectly
  * from another glib-function, e.g. as a callback.
index be1dc26f167f9f1b9208b28dd1b78ed6f7df3353..aa290d05cb3b1c29fbc1f06ae69a0a51f128a923 100644 (file)
@@ -53,7 +53,7 @@
 
 #define G_NSEC_PER_SEC 1000000000
 
-#define GETTIME(v) (v = G_THREAD_UF (gettime, ()))
+#define GETTIME(v) (v = g_thread_gettime ())
 
 struct _GTimer
 {
index d8f26d4c5b7797f3ae2387409d07cb87d8496a03..6459077395c41e45fb1199d27fefa8b467776ab1 100644 (file)
@@ -312,6 +312,8 @@ g_thread_init (GThreadFunctions* init)
     g_thread_use_default_impl = FALSE;
 
   g_thread_functions_for_glib_use = *init;
+  if (g_thread_gettime_impl)
+    g_thread_gettime = g_thread_gettime_impl;
 
   supported = (init->mutex_new &&
               init->mutex_lock &&
@@ -332,8 +334,7 @@ g_thread_init (GThreadFunctions* init)
               init->thread_join &&
               init->thread_exit &&
               init->thread_set_priority &&
-              init->thread_self &&
-               init->gettime);
+              init->thread_self);
 
   /* if somebody is calling g_thread_init (), it means that he wants to
    * have thread support, so check this
index fb4c887109a2237d154f705584a3ddee5982aa1a..6fbeff1606e7cb20e9cfc5c51f34f17ee6051b24 100644 (file)
@@ -34,4 +34,6 @@
 static GThreadFunctions
 g_thread_functions_for_glib_use_default; /* is NULLified */
 
+static guint64 (*g_thread_gettime_impl) (void) = NULL;
 #define G_MUTEX_SIZE 0
index 711fcd3a733351851cd5a919af57c9e2df3429f5..01121bf4c05229bb0d0a069f53093d19b0fb8ae4 100644 (file)
@@ -426,23 +426,20 @@ g_thread_equal_posix_impl (gpointer thread1, gpointer thread2)
   return (pthread_equal (*(pthread_t*)thread1, *(pthread_t*)thread2) != 0);
 }
 
+#ifdef USE_CLOCK_GETTIME 
 static guint64
-g_gettime_posix_impl (void)
+gettime (void)
 {
-#ifdef USE_CLOCK_GETTIME 
   struct timespec tv;
 
   clock_gettime (posix_clock, &tv);
 
   return (guint64) tv.tv_sec * G_NSEC_PER_SEC + tv.tv_nsec;
+}
+static guint64 (*g_thread_gettime_impl)(void) = gettime;
 #else
-  struct timeval tv;
-
-  gettimeofday (&tv, NULL);
-
-  return (guint64) tv.tv_sec * G_NSEC_PER_SEC + tv.tv_usec * (G_NSEC_PER_SEC / G_USEC_PER_SEC);
+static guint64 (*g_thread_gettime_impl)(void) = 0;
 #endif
-}
 
 static GThreadFunctions g_thread_functions_for_glib_use_default =
 {
@@ -466,6 +463,5 @@ static GThreadFunctions g_thread_functions_for_glib_use_default =
   g_thread_exit_posix_impl,
   g_thread_set_priority_posix_impl,
   g_thread_self_posix_impl,
-  g_thread_equal_posix_impl,
-  g_gettime_posix_impl
+  g_thread_equal_posix_impl
 };
index 78e2ecda41feff5b4c9f1e9a7776db6ea6dcb35a..657423f449e174063e4233c1971ce0c9daa91d0d 100644 (file)
@@ -546,7 +546,7 @@ g_thread_join_win32_impl (gpointer thread)
 }
 
 static guint64
-g_gettime_win32_impl (void)
+g_thread_gettime_impl (void)
 {
   guint64 v;
 
@@ -583,8 +583,7 @@ static GThreadFunctions g_thread_functions_for_glib_use_default =
   g_thread_exit_win32_impl,
   g_thread_set_priority_win32_impl,
   g_thread_self_win32_impl,
-  NULL,                             /* no equal function necessary */
-  g_gettime_win32_impl
+  NULL                             /* no equal function necessary */
 };
 
 #define HAVE_G_THREAD_IMPL_INIT