summaryrefslogtreecommitdiffstats
path: root/lf_fifo.c
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2009-11-08 02:10:49 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2009-11-08 02:10:49 +0100
commite99dc95b4cb3ea7ea1cf5fb1606319667bff83cf (patch)
treeacabd686d473db40091888a2a00534d132cff320 /lf_fifo.c
parent0f44dc69adb225a3c5410234491fc8950ed935f7 (diff)
downloadlock_free-e99dc95b4cb3ea7ea1cf5fb1606319667bff83cf.zip
lock_free-e99dc95b4cb3ea7ea1cf5fb1606319667bff83cf.tar.gz
union ptr_u and lf_eql added to lf_cas
Diffstat (limited to 'lf_fifo.c')
-rw-r--r--lf_fifo.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/lf_fifo.c b/lf_fifo.c
index 1f4ab90..963d53b 100644
--- a/lf_fifo.c
+++ b/lf_fifo.c
@@ -28,11 +28,6 @@
#include "lf_fifo.h"
#include "stdlib.h"
-union ptr_u {
- lf_pointer_t ptr;
- volatile long long concat;
-};
-
/* initialize an empty lf_fifo structure */
void lf_fifo_init( lf_fifo_t *q ) {
q->head.ptr = q->tail.ptr = NULL;
@@ -65,7 +60,7 @@ void lf_fifo_push( lf_fifo_t *q, lf_pointer_t *node ) {
/* snapshot last through tail */
last = *tail.ptr;
/* if tail is still consistant */
- if (((union ptr_u)tail).concat == ((union ptr_u)q->tail).concat) {
+ if lf_eql(tail,q->tail) {
/* if last is the last node */
if (last.ptr == NULL) {
tmp.count = last.count+1;
@@ -105,7 +100,7 @@ lf_pointer_t* pop( lf_fifo_t *q ) {
cas( &q->tail, tail, tmp );
} else {
/* get the node ptr */
- node = (lf_pointer_t *)head.ptr;
+ node = (lf_pointer_t*)head.ptr;
/* get the next head ready */
tmp.ptr = node->ptr;
tmp.count = head.count+1;