int error = (err); \
if (error) \
g_error ("file %s: line %d (%s): error '%s' during '%s'", \
- __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION, \
+ __FILE__, __LINE__, G_STRFUNC, \
g_strerror (error), name); \
}G_STMT_END
#define G_MUTEX_SIZE (sizeof (pthread_mutex_t))
-#if defined(_SC_THREAD_STACK_MIN) || defined (HAVE_PRIORITIES)
+#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)
#define HAVE_G_THREAD_IMPL_INIT
static void
g_thread_impl_init(void)
# 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 */
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,