1 #if defined(i386) || defined(__x86_64__)
3 #include <libkern/OSAtomic.h>
13 int atomic_fifo_queue_test( void *the_argp
) {
14 OSFifoQueueHead head
= OS_ATOMIC_FIFO_QUEUE_INIT
;
15 char *str1
= "String 1", *str2
= "String 2";
16 QueueNode node1
= { 0, str1
};
17 OSAtomicFifoEnqueue(&head
, &node1
, 0);
18 QueueNode node2
= { 0, str2
};
19 OSAtomicFifoEnqueue(&head
, &node2
, 0);
20 QueueNode
*node_ptr
= OSAtomicFifoDequeue(&head
, 0);
21 if( strcmp(node_ptr
->str
, str1
) != 0 ) {
22 warnx("OSAtomicFifoDequeue returned incorrect string. Expected %s, got %s", str1
, node_ptr
->str
);
25 node_ptr
= OSAtomicFifoDequeue(&head
, 0);
26 if( strcmp(node_ptr
->str
, str2
) != 0 ) {
27 warnx("OSAtomicFifoDequeue returned incorrect string. Expected %s, got %s", str2
, node_ptr
->str
);