#include "gthreadprivate.h"
#include "config.h"
-
-#ifdef G_BIT_LOCK_FORCE_FUTEX_EMULATION
#undef HAVE_FUTEX
+#ifdef G_BIT_LOCK_FORCE_FUTEX_EMULATION
#endif
#ifndef HAVE_FUTEX
{
const volatile gint *address;
gint ref_count;
- GCond *wait_queue;
+ GCond wait_queue;
} WaitAddress;
static WaitAddress *
{
waiter = g_slice_new (WaitAddress);
waiter->address = address;
- waiter->wait_queue = g_cond_new ();
+ g_cond_init (&waiter->wait_queue);
waiter->ref_count = 0;
g_futex_address_list =
g_slist_prepend (g_futex_address_list, waiter);
}
waiter->ref_count++;
- g_cond_wait (waiter->wait_queue, &g_futex_mutex);
+ g_cond_wait (&waiter->wait_queue, &g_futex_mutex);
if (!--waiter->ref_count)
{
g_futex_address_list =
g_slist_remove (g_futex_address_list, waiter);
- g_cond_free (waiter->wait_queue);
+ g_cond_clear (&waiter->wait_queue);
g_slice_free (WaitAddress, waiter);
}
}
*/
g_mutex_lock (&g_futex_mutex);
if ((waiter = g_futex_find_address (address)))
- g_cond_signal (waiter->wait_queue);
+ g_cond_signal (&waiter->wait_queue);
g_mutex_unlock (&g_futex_mutex);
}
#endif
/* Local Data {{{1 -------------------------------------------------------- */
static GMutex g_once_mutex = G_MUTEX_INIT;
-static GCond *g_once_cond = NULL;
+static GCond g_once_cond = G_COND_INIT;
static GPrivate *g_thread_specific_private = NULL;
static GRealThread *g_thread_all_threads = NULL;
static GSList *g_thread_free_indices = NULL;
*/
GRealThread* main_thread = (GRealThread*) g_thread_self ();
- /* mutex and cond creation works without g_threads_got_initialized */
- g_once_cond = g_cond_new ();
-
/* we may only create mutex and cond in here */
_g_mem_thread_init_noprivate_nomessage ();
g_mutex_lock (&g_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_once_mutex);
if (once->status != G_ONCE_STATUS_READY)
{
g_mutex_lock (&g_once_mutex);
once->status = G_ONCE_STATUS_READY;
- g_cond_broadcast (g_once_cond);
+ g_cond_broadcast (&g_once_cond);
}
g_mutex_unlock (&g_once_mutex);
}
else
do
- g_cond_wait (g_once_cond, &g_once_mutex);
+ g_cond_wait (&g_once_cond, &g_once_mutex);
while (g_slist_find (g_once_init_list, (void*) value_location));
}
g_mutex_unlock (&g_once_mutex);
g_atomic_pointer_set (value_location, initialization_value);
g_mutex_lock (&g_once_mutex);
g_once_init_list = g_slist_remove (g_once_init_list, (void*) value_location);
- g_cond_broadcast (g_once_cond);
+ g_cond_broadcast (&g_once_cond);
g_mutex_unlock (&g_once_mutex);
}