mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
Revert an accidental ABI break by moving gettime out of the
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
This commit is contained in:
parent
098d17a4fc
commit
4bbde50716
10
ChangeLog
10
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>
|
2007-01-16 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
* glib/gthread.c (gettime): GetSystemTimeAsFileTime() returns 100s
|
* glib/gthread.c (gettime): GetSystemTimeAsFileTime() returns 100s
|
||||||
|
@ -1127,6 +1127,7 @@ g_thread_init_glib
|
|||||||
g_thread_functions_for_glib_use
|
g_thread_functions_for_glib_use
|
||||||
g_threads_got_initialized
|
g_threads_got_initialized
|
||||||
g_thread_use_default_impl
|
g_thread_use_default_impl
|
||||||
|
g_thread_gettime
|
||||||
#endif
|
#endif
|
||||||
g_thread_create_full
|
g_thread_create_full
|
||||||
g_thread_error_quark
|
g_thread_error_quark
|
||||||
|
@ -80,6 +80,8 @@ static void g_thread_cleanup (gpointer data);
|
|||||||
static void g_thread_fail (void);
|
static void g_thread_fail (void);
|
||||||
static guint64 gettime (void);
|
static guint64 gettime (void);
|
||||||
|
|
||||||
|
guint64 (*g_thread_gettime) (void) = gettime;
|
||||||
|
|
||||||
/* Global variables */
|
/* Global variables */
|
||||||
|
|
||||||
static GSystemThread zero_thread; /* This is initialized to all zero */
|
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_join */
|
||||||
NULL, /* thread_exit */
|
NULL, /* thread_exit */
|
||||||
NULL, /* thread_set_priority */
|
NULL, /* thread_set_priority */
|
||||||
NULL, /* thread_self */
|
NULL, /* thread_self */
|
||||||
NULL, /* thread_equal */
|
NULL /* thread_equal */
|
||||||
gettime /* gettime */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Local data */
|
/* Local data */
|
||||||
|
@ -106,13 +106,14 @@ struct _GThreadFunctions
|
|||||||
void (*thread_self) (gpointer thread);
|
void (*thread_self) (gpointer thread);
|
||||||
gboolean (*thread_equal) (gpointer thread1,
|
gboolean (*thread_equal) (gpointer thread1,
|
||||||
gpointer thread2);
|
gpointer thread2);
|
||||||
guint64 (*gettime) (void);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GLIB_VAR GThreadFunctions g_thread_functions_for_glib_use;
|
GLIB_VAR GThreadFunctions g_thread_functions_for_glib_use;
|
||||||
GLIB_VAR gboolean g_thread_use_default_impl;
|
GLIB_VAR gboolean g_thread_use_default_impl;
|
||||||
GLIB_VAR gboolean g_threads_got_initialized;
|
GLIB_VAR gboolean g_threads_got_initialized;
|
||||||
|
|
||||||
|
GLIB_VAR guint64 (*g_thread_gettime) (void);
|
||||||
|
|
||||||
/* initializes the mutex/cond/private implementation for glib, might
|
/* initializes the mutex/cond/private implementation for glib, might
|
||||||
* only be called once, and must not be called directly or indirectly
|
* only be called once, and must not be called directly or indirectly
|
||||||
* from another glib-function, e.g. as a callback.
|
* from another glib-function, e.g. as a callback.
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
#define G_NSEC_PER_SEC 1000000000
|
#define G_NSEC_PER_SEC 1000000000
|
||||||
|
|
||||||
#define GETTIME(v) (v = G_THREAD_UF (gettime, ()))
|
#define GETTIME(v) (v = g_thread_gettime ())
|
||||||
|
|
||||||
struct _GTimer
|
struct _GTimer
|
||||||
{
|
{
|
||||||
|
@ -312,6 +312,8 @@ g_thread_init (GThreadFunctions* init)
|
|||||||
g_thread_use_default_impl = FALSE;
|
g_thread_use_default_impl = FALSE;
|
||||||
|
|
||||||
g_thread_functions_for_glib_use = *init;
|
g_thread_functions_for_glib_use = *init;
|
||||||
|
if (g_thread_gettime_impl)
|
||||||
|
g_thread_gettime = g_thread_gettime_impl;
|
||||||
|
|
||||||
supported = (init->mutex_new &&
|
supported = (init->mutex_new &&
|
||||||
init->mutex_lock &&
|
init->mutex_lock &&
|
||||||
@ -332,8 +334,7 @@ g_thread_init (GThreadFunctions* init)
|
|||||||
init->thread_join &&
|
init->thread_join &&
|
||||||
init->thread_exit &&
|
init->thread_exit &&
|
||||||
init->thread_set_priority &&
|
init->thread_set_priority &&
|
||||||
init->thread_self &&
|
init->thread_self);
|
||||||
init->gettime);
|
|
||||||
|
|
||||||
/* if somebody is calling g_thread_init (), it means that he wants to
|
/* if somebody is calling g_thread_init (), it means that he wants to
|
||||||
* have thread support, so check this
|
* have thread support, so check this
|
||||||
|
@ -34,4 +34,6 @@
|
|||||||
static GThreadFunctions
|
static GThreadFunctions
|
||||||
g_thread_functions_for_glib_use_default; /* is NULLified */
|
g_thread_functions_for_glib_use_default; /* is NULLified */
|
||||||
|
|
||||||
|
static guint64 (*g_thread_gettime_impl) (void) = NULL;
|
||||||
|
|
||||||
#define G_MUTEX_SIZE 0
|
#define G_MUTEX_SIZE 0
|
||||||
|
@ -426,23 +426,20 @@ g_thread_equal_posix_impl (gpointer thread1, gpointer thread2)
|
|||||||
return (pthread_equal (*(pthread_t*)thread1, *(pthread_t*)thread2) != 0);
|
return (pthread_equal (*(pthread_t*)thread1, *(pthread_t*)thread2) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint64
|
|
||||||
g_gettime_posix_impl (void)
|
|
||||||
{
|
|
||||||
#ifdef USE_CLOCK_GETTIME
|
#ifdef USE_CLOCK_GETTIME
|
||||||
|
static guint64
|
||||||
|
gettime (void)
|
||||||
|
{
|
||||||
struct timespec tv;
|
struct timespec tv;
|
||||||
|
|
||||||
clock_gettime (posix_clock, &tv);
|
clock_gettime (posix_clock, &tv);
|
||||||
|
|
||||||
return (guint64) tv.tv_sec * G_NSEC_PER_SEC + tv.tv_nsec;
|
return (guint64) tv.tv_sec * G_NSEC_PER_SEC + tv.tv_nsec;
|
||||||
#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);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
static guint64 (*g_thread_gettime_impl)(void) = gettime;
|
||||||
|
#else
|
||||||
|
static guint64 (*g_thread_gettime_impl)(void) = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
static GThreadFunctions g_thread_functions_for_glib_use_default =
|
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_exit_posix_impl,
|
||||||
g_thread_set_priority_posix_impl,
|
g_thread_set_priority_posix_impl,
|
||||||
g_thread_self_posix_impl,
|
g_thread_self_posix_impl,
|
||||||
g_thread_equal_posix_impl,
|
g_thread_equal_posix_impl
|
||||||
g_gettime_posix_impl
|
|
||||||
};
|
};
|
||||||
|
@ -546,7 +546,7 @@ g_thread_join_win32_impl (gpointer thread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static guint64
|
static guint64
|
||||||
g_gettime_win32_impl (void)
|
g_thread_gettime_impl (void)
|
||||||
{
|
{
|
||||||
guint64 v;
|
guint64 v;
|
||||||
|
|
||||||
@ -583,8 +583,7 @@ static GThreadFunctions g_thread_functions_for_glib_use_default =
|
|||||||
g_thread_exit_win32_impl,
|
g_thread_exit_win32_impl,
|
||||||
g_thread_set_priority_win32_impl,
|
g_thread_set_priority_win32_impl,
|
||||||
g_thread_self_win32_impl,
|
g_thread_self_win32_impl,
|
||||||
NULL, /* no equal function necessary */
|
NULL /* no equal function necessary */
|
||||||
g_gettime_win32_impl
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define HAVE_G_THREAD_IMPL_INIT
|
#define HAVE_G_THREAD_IMPL_INIT
|
||||||
|
Loading…
Reference in New Issue
Block a user