mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 19:36:18 +01:00
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:
parent
8cff9c57b1
commit
d537726ded
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user