#include <gst/gst.h>
#include "gstatomicqueue.h"
+#include "glib-compat-private.h"
/**
* SECTION:gstatomicqueue
{
do {
mem->free = g_atomic_pointer_get (&queue->free_list);
- } while (!g_atomic_pointer_compare_and_exchange ((gpointer *) &
- queue->free_list, mem->free, mem));
+ } while (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&queue->free_list,
+ mem->free, mem));
}
static void
free_list = g_atomic_pointer_get (&queue->free_list);
if (free_list == NULL)
return;
- } while (!g_atomic_pointer_compare_and_exchange ((gpointer *) &
- queue->free_list, free_list, NULL));
+ } while (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&queue->free_list, free_list,
+ NULL));
while (free_list) {
GstAQueueMem *next = free_list->free;
/* now we try to move the next array as the head memory. If we fail to do that,
* some other reader managed to do it first and we retry */
- if (!g_atomic_pointer_compare_and_exchange ((gpointer *) &
- queue->head_mem, head_mem, next))
+ if (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&queue->head_mem, head_mem,
+ next))
continue;
/* when we managed to swing the head pointer the old head is now
/* now we try to move the next array as the head memory. If we fail to do that,
* some other reader managed to do it first and we retry */
- if (!g_atomic_pointer_compare_and_exchange ((gpointer *) &
- queue->head_mem, head_mem, next))
+ if (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&queue->head_mem, head_mem,
+ next))
continue;
/* when we managed to swing the head pointer the old head is now
mem = new_queue_mem ((size << 1) + 1, tail);
/* try to make our new array visible to other writers */
- if (!g_atomic_pointer_compare_and_exchange ((gpointer *) &
- queue->tail_mem, tail_mem, mem)) {
+ if (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&queue->tail_mem, tail_mem,
+ mem)) {
/* we tried to swap the new writer array but something changed. This is
* because some other writer beat us to it, we free our memory and try
* again */