Make thread calls unconditional if G_THREADS_MANDATORY is set
authorAlexander Larsson <alexl@redhat.com>
Tue, 12 Jan 2010 20:26:52 +0000 (21:26 +0100)
committerAlexander Larsson <alexl@redhat.com>
Tue, 12 Jan 2010 20:37:41 +0000 (21:37 +0100)
Since gobject now initialized threads unconditionally if threads are
available it makes no sense to have each thread operation
conditionally check if threads are enables, so allow this to be avoided.

https://bugzilla.gnome.org/show_bug.cgi?id=606775

glib/gthread.h

index 019d0db..7a0abba 100644 (file)
@@ -198,7 +198,11 @@ GMutex* g_static_mutex_get_mutex_impl   (GMutex **mutex);
           (cond, mutex, abs_time, G_MUTEX_DEBUG_MAGIC, G_STRLOC) : TRUE)
 #endif /* G_ERRORCHECK_MUTEXES */
 
+#if defined(G_THREADS_ENABLED) && defined(G_THREADS_MANDATORY)
+#define g_thread_supported()     1
+#else
 #define g_thread_supported()    (g_threads_got_initialized)
+#endif
 #define g_mutex_new()            G_THREAD_UF (mutex_new,      ())
 #define g_cond_new()             G_THREAD_UF (cond_new,       ())
 #define g_cond_signal(cond)      G_THREAD_CF (cond_signal,    (void)0, (cond))