}
static gpointer
-g_async_queue_pop_intern_unlocked (GAsyncQueue* queue, gboolean try,
- GTimeVal *end_time)
+g_async_queue_pop_intern_unlocked (GAsyncQueue *queue,
+ gboolean try,
+ GTimeVal *end_time)
{
gpointer retval;
- if (!g_queue_peek_tail (queue->queue))
+ if (!g_queue_peek_tail_link (queue->queue))
{
if (try)
return NULL;
if (!end_time)
{
queue->waiting_threads++;
- while (!g_queue_peek_tail (queue->queue))
- g_cond_wait(queue->cond, queue->mutex);
+ while (!g_queue_peek_tail_link (queue->queue))
+ g_cond_wait (queue->cond, queue->mutex);
queue->waiting_threads--;
}
else
{
queue->waiting_threads++;
- while (!g_queue_peek_tail (queue->queue))
+ while (!g_queue_peek_tail_link (queue->queue))
if (!g_cond_timed_wait (queue->cond, queue->mutex, end_time))
break;
queue->waiting_threads--;
- if (!g_queue_peek_tail (queue->queue))
+ if (!g_queue_peek_tail_link (queue->queue))
return NULL;
}
}
*
* If you were sorting a list of priority numbers to make sure the
* lowest priority would be at the top of the queue, you could use:
- * <informalexample><programlisting>
+ * |[
* gint32 id1;
* gint32 id2;
*
* id2 = GPOINTER_TO_INT (element2);
*
* return (id1 > id2 ? +1 : id1 == id2 ? 0 : -1);
- * </programlisting></informalexample>
+ * ]|
*
* Since: 2.10
**/
&sd);
}
+/*
+ * Private API
+ */
+
+GMutex*
+_g_async_queue_get_mutex (GAsyncQueue* queue)
+{
+ g_return_val_if_fail (queue, NULL);
+ g_return_val_if_fail (g_atomic_int_get (&queue->ref_count) > 0, NULL);
+
+ return queue->mutex;
+}
+
#define __G_ASYNCQUEUE_C__
#include "galiasdef.c"