thread: stop sharing g_once_mutex

Unrelated code shouldn't be sharing the same mutex for no good reason --
particularly not across a file boundary.
This commit is contained in:
Ryan Lortie 2011-10-12 21:47:25 -04:00
parent 8cff9c57b1
commit d537726ded
3 changed files with 6 additions and 7 deletions

View File

@ -199,6 +199,7 @@ static GSList *g_thread_all_threads = NULL;
static GSList *g_thread_free_indices = NULL;
/* Protects g_thread_all_threads and g_thread_free_indices */
G_LOCK_DEFINE_STATIC (g_static_mutex);
G_LOCK_DEFINE_STATIC (g_thread);
/* Misc. GThread functions {{{1 */
@ -504,7 +505,7 @@ g_static_mutex_get_mutex_impl (GStaticMutex* mutex)
if (!result)
{
g_mutex_lock (&g_once_mutex);
G_LOCK (g_static_mutex);
result = mutex->mutex;
if (!result)
@ -513,7 +514,7 @@ g_static_mutex_get_mutex_impl (GStaticMutex* mutex)
g_atomic_pointer_set (&mutex->mutex, result);
}
g_mutex_unlock (&g_once_mutex);
G_UNLOCK (g_static_mutex);
}
return result;
@ -660,7 +661,7 @@ g_static_rec_mutex_get_rec_mutex_impl (GStaticRecMutex* mutex)
if (!result)
{
g_mutex_lock (&g_once_mutex);
G_LOCK (g_static_mutex);
result = (GRecMutex *) mutex->mutex.mutex;
if (!result)
@ -670,7 +671,7 @@ g_static_rec_mutex_get_rec_mutex_impl (GStaticRecMutex* mutex)
g_atomic_pointer_set (&mutex->mutex.mutex, result);
}
g_mutex_unlock (&g_once_mutex);
G_UNLOCK (g_static_mutex);
}
return result;

View File

@ -468,7 +468,7 @@ g_thread_error_quark (void)
/* Local Data {{{1 -------------------------------------------------------- */
GMutex g_once_mutex;
static GMutex g_once_mutex;
static GCond g_once_cond;
static GSList *g_once_init_list = NULL;

View File

@ -61,8 +61,6 @@ struct _GRealThread
GSystemThread system_thread;
};
G_GNUC_INTERNAL extern GMutex g_once_mutex;
#ifdef G_OS_WIN32
G_GNUC_INTERNAL void g_thread_DllMain (void);
#endif