Hi, does this patch makes any sense?
diff --git a/glib/gthread.c b/glib/gthread.c index ee87574..60cff76 100644 --- a/glib/gthread.c +++ b/glib/gthread.c @@ -522,7 +522,7 @@ G_DEFINE_QUARK (g_thread_error, g_thread_error) /* Local Data {{{1 -------------------------------------------------------- */ -static GMutex g_once_mutex; +static G_LOCK_DEFINE(once_mutex); static GCond g_once_cond; static GSList *g_once_init_list = NULL; @@ -610,24 +610,24 @@ g_once_impl (GOnce *once, GThreadFunc func, gpointer arg) { - g_mutex_lock (&g_once_mutex); + G_LOCK(once_mutex); while (once->status == G_ONCE_STATUS_PROGRESS) - g_cond_wait (&g_once_cond, &g_once_mutex); + g_cond_wait (&g_once_cond, &G_LOCK_NAME(once_mutex)); if (once->status != G_ONCE_STATUS_READY) { once->status = G_ONCE_STATUS_PROGRESS; - g_mutex_unlock (&g_once_mutex); + G_UNLOCK (once_mutex); once->retval = func (arg); - g_mutex_lock (&g_once_mutex); + G_LOCK(once_mutex); once->status = G_ONCE_STATUS_READY; g_cond_broadcast (&g_once_cond); } - g_mutex_unlock (&g_once_mutex); + G_UNLOCK (once_mutex); return once->retval; } @@ -669,7 +669,7 @@ gboolean { volatile gsize *value_location = location; gboolean need_init = FALSE; - g_mutex_lock (&g_once_mutex); + G_LOCK(once_mutex); if (g_atomic_pointer_get (value_location) == NULL) { if (!g_slist_find (g_once_init_list, (void*) value_location)) @@ -679,10 +679,10 @@ gboolean } else do - g_cond_wait (&g_once_cond, &g_once_mutex); + g_cond_wait (&g_once_cond, &G_LOCK_NAME(once_mutex)); while (g_slist_find (g_once_init_list, (void*) value_location)); } - g_mutex_unlock (&g_once_mutex); + G_UNLOCK (once_mutex); return need_init; } @@ -710,10 +710,10 @@ void g_return_if_fail (g_once_init_list != NULL); g_atomic_pointer_set (value_location, result); - g_mutex_lock (&g_once_mutex); + G_LOCK(once_mutex); g_once_init_list = g_slist_remove (g_once_init_list, (void*) value_location); g_cond_broadcast (&g_once_cond); - g_mutex_unlock (&g_once_mutex); + G_UNLOCK (once_mutex); } /* GThread {{{1 -------------------------------------------------------- */ _______________________________________________ gtk-devel-list mailing list gtk-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-devel-list