diff options
author | Ryan Lortie <desrt@desrt.ca> | 2011-08-31 15:49:35 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2011-09-09 12:47:39 -0400 |
commit | e48573c402326a9428b032b0d33dd06644316990 (patch) | |
tree | 14bcb0dd0de93478b836970d0ab6472dffc795ac /gthread | |
parent | 3534ff418c85481d245631abb06e89b8898790f4 (diff) | |
download | glib-e48573c402326a9428b032b0d33dd06644316990.tar.gz |
Deprecated (undocumented) g_thread_gettime
g_thread_gettime() is an undocumented public function pointer that
points to a function that returns the monotonic time in nanoseconds.
g_get_monotonic_time() does the same in microseconds, so it can be used
instead.
GLib had one internal user in GFileMonitor that only cared about
millisecond accuracy; it has been ported to g_get_monotonic_time().
Diffstat (limited to 'gthread')
-rw-r--r-- | gthread/gthread-impl.c | 2 | ||||
-rw-r--r-- | gthread/gthread-none.c | 2 | ||||
-rw-r--r-- | gthread/gthread-posix.c | 29 | ||||
-rw-r--r-- | gthread/gthread-win32.c | 16 |
4 files changed, 1 insertions, 48 deletions
diff --git a/gthread/gthread-impl.c b/gthread/gthread-impl.c index 678b3b8fe..97a497089 100644 --- a/gthread/gthread-impl.c +++ b/gthread/gthread-impl.c @@ -315,8 +315,6 @@ 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 && diff --git a/gthread/gthread-none.c b/gthread/gthread-none.c index 6fbeff160..fb4c88710 100644 --- a/gthread/gthread-none.c +++ b/gthread/gthread-none.c @@ -34,6 +34,4 @@ static GThreadFunctions g_thread_functions_for_glib_use_default; /* is NULLified */ -static guint64 (*g_thread_gettime_impl) (void) = NULL; - #define G_MUTEX_SIZE 0 diff --git a/gthread/gthread-posix.c b/gthread/gthread-posix.c index 9188f843e..5fbcf2803 100644 --- a/gthread/gthread-posix.c +++ b/gthread/gthread-posix.c @@ -119,12 +119,7 @@ static gulong g_thread_min_stack_size = 0; #define G_MUTEX_SIZE (sizeof (pthread_mutex_t)) -#if defined(HAVE_CLOCK_GETTIME) && defined(HAVE_MONOTONIC_CLOCK) -#define USE_CLOCK_GETTIME 1 -static gint posix_clock = 0; -#endif - -#if defined(_SC_THREAD_STACK_MIN) || defined (HAVE_PRIORITIES) || defined (USE_CLOCK_GETTIME) +#if defined(_SC_THREAD_STACK_MIN) || defined (HAVE_PRIORITIES) #define HAVE_G_THREAD_IMPL_INIT static void g_thread_impl_init(void) @@ -146,13 +141,6 @@ g_thread_impl_init(void) g_thread_priority_map [priority])); # endif #endif /* HAVE_PRIORITIES */ - -#ifdef USE_CLOCK_GETTIME - if (sysconf (_SC_MONOTONIC_CLOCK) >= 0) - posix_clock = CLOCK_MONOTONIC; - else - posix_clock = CLOCK_REALTIME; -#endif } #endif /* _SC_THREAD_STACK_MIN || HAVE_PRIORITIES */ @@ -426,21 +414,6 @@ 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 -gettime (void) -{ - 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 -static guint64 (*g_thread_gettime_impl)(void) = 0; -#endif - static GThreadFunctions g_thread_functions_for_glib_use_default = { g_mutex_new_posix_impl, diff --git a/gthread/gthread-win32.c b/gthread/gthread-win32.c index 465b20550..c72d061b1 100644 --- a/gthread/gthread-win32.c +++ b/gthread/gthread-win32.c @@ -545,22 +545,6 @@ g_thread_join_win32_impl (gpointer thread) g_free (target); } -static guint64 -g_thread_gettime_impl (void) -{ - guint64 v; - - /* Returns 100s of nanoseconds since start of 1601 */ - GetSystemTimeAsFileTime ((FILETIME *)&v); - - /* Offset to Unix epoch */ - v -= G_GINT64_CONSTANT (116444736000000000); - /* Convert to nanoseconds */ - v *= 100; - - return v; -} - static GThreadFunctions g_thread_functions_for_glib_use_default = { g_mutex_new_win32_impl, /* mutex */ |