g_async_queue_ref (GAsyncQueue *queue)
{
g_return_if_fail (queue);
- g_return_if_fail (queue->ref_count > 0);
+ g_return_if_fail (g_atomic_int_get (&queue->ref_count) > 0);
g_atomic_int_inc (&queue->ref_count);
}
g_async_queue_ref_unlocked (GAsyncQueue *queue)
{
g_return_if_fail (queue);
- g_return_if_fail (queue->ref_count > 0);
+ g_return_if_fail (g_atomic_int_get (&queue->ref_count) > 0);
g_atomic_int_inc (&queue->ref_count);
}
g_async_queue_unref_and_unlock (GAsyncQueue *queue)
{
g_return_if_fail (queue);
- g_return_if_fail (queue->ref_count > 0);
+ g_return_if_fail (g_atomic_int_get (&queue->ref_count) > 0);
g_mutex_unlock (queue->mutex);
g_async_queue_unref (queue);
g_async_queue_unref (GAsyncQueue *queue)
{
g_return_if_fail (queue);
- g_return_if_fail (queue->ref_count > 0);
+ g_return_if_fail (g_atomic_int_get (&queue->ref_count) > 0);
if (g_atomic_int_dec_and_test (&queue->ref_count))
{
g_async_queue_lock (GAsyncQueue *queue)
{
g_return_if_fail (queue);
- g_return_if_fail (queue->ref_count > 0);
+ g_return_if_fail (g_atomic_int_get (&queue->ref_count) > 0);
g_mutex_lock (queue->mutex);
}
g_async_queue_unlock (GAsyncQueue *queue)
{
g_return_if_fail (queue);
- g_return_if_fail (queue->ref_count > 0);
+ g_return_if_fail (g_atomic_int_get (&queue->ref_count) > 0);
g_mutex_unlock (queue->mutex);
}
g_async_queue_push (GAsyncQueue* queue, gpointer data)
{
g_return_if_fail (queue);
- g_return_if_fail (queue->ref_count > 0);
+ g_return_if_fail (g_atomic_int_get (&queue->ref_count) > 0);
g_return_if_fail (data);
g_mutex_lock (queue->mutex);
g_async_queue_push_unlocked (GAsyncQueue* queue, gpointer data)
{
g_return_if_fail (queue);
- g_return_if_fail (queue->ref_count > 0);
+ g_return_if_fail (g_atomic_int_get (&queue->ref_count) > 0);
g_return_if_fail (data);
g_queue_push_head (queue->queue, data);
gpointer retval;
g_return_val_if_fail (queue, NULL);
- g_return_val_if_fail (queue->ref_count > 0, NULL);
+ g_return_val_if_fail (g_atomic_int_get (&queue->ref_count) > 0, NULL);
g_mutex_lock (queue->mutex);
retval = g_async_queue_pop_intern_unlocked (queue, FALSE, NULL);
g_async_queue_pop_unlocked (GAsyncQueue* queue)
{
g_return_val_if_fail (queue, NULL);
- g_return_val_if_fail (queue->ref_count > 0, NULL);
+ g_return_val_if_fail (g_atomic_int_get (&queue->ref_count) > 0, NULL);
return g_async_queue_pop_intern_unlocked (queue, FALSE, NULL);
}
gpointer retval;
g_return_val_if_fail (queue, NULL);
- g_return_val_if_fail (queue->ref_count > 0, NULL);
+ g_return_val_if_fail (g_atomic_int_get (&queue->ref_count) > 0, NULL);
g_mutex_lock (queue->mutex);
retval = g_async_queue_pop_intern_unlocked (queue, TRUE, NULL);
g_async_queue_try_pop_unlocked (GAsyncQueue* queue)
{
g_return_val_if_fail (queue, NULL);
- g_return_val_if_fail (queue->ref_count > 0, NULL);
+ g_return_val_if_fail (g_atomic_int_get (&queue->ref_count) > 0, NULL);
return g_async_queue_pop_intern_unlocked (queue, TRUE, NULL);
}
gpointer retval;
g_return_val_if_fail (queue, NULL);
- g_return_val_if_fail (queue->ref_count > 0, NULL);
+ g_return_val_if_fail (g_atomic_int_get (&queue->ref_count) > 0, NULL);
g_mutex_lock (queue->mutex);
retval = g_async_queue_pop_intern_unlocked (queue, FALSE, end_time);
g_async_queue_timed_pop_unlocked (GAsyncQueue* queue, GTimeVal *end_time)
{
g_return_val_if_fail (queue, NULL);
- g_return_val_if_fail (queue->ref_count > 0, NULL);
+ g_return_val_if_fail (g_atomic_int_get (&queue->ref_count) > 0, NULL);
return g_async_queue_pop_intern_unlocked (queue, FALSE, end_time);
}
gint retval;
g_return_val_if_fail (queue, 0);
- g_return_val_if_fail (queue->ref_count > 0, 0);
+ g_return_val_if_fail (g_atomic_int_get (&queue->ref_count) > 0, 0);
g_mutex_lock (queue->mutex);
retval = queue->queue->length - queue->waiting_threads;
g_async_queue_length_unlocked (GAsyncQueue* queue)
{
g_return_val_if_fail (queue, 0);
- g_return_val_if_fail (queue->ref_count > 0, 0);
+ g_return_val_if_fail (g_atomic_int_get (&queue->ref_count) > 0, 0);
return queue->queue->length - queue->waiting_threads;
}