diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2009-11-07 17:14:28 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2009-11-07 17:14:28 +0100 |
commit | 67f57ab2fb7932b1c43ad669e846b425f6fa1f2b (patch) | |
tree | 95e6fc348b067c8ea03c6c3f35a0284c97ddc76f | |
parent | 9c483a02cb2c8d3c67c3cdd1f34630191fa55c1d (diff) | |
download | lock_free-67f57ab2fb7932b1c43ad669e846b425f6fa1f2b.zip lock_free-67f57ab2fb7932b1c43ad669e846b425f6fa1f2b.tar.gz |
push_tail and pop_head goes push and pop
-rw-r--r-- | lf_fifo.c | 4 | ||||
-rw-r--r-- | lf_fifo.h | 4 | ||||
-rw-r--r-- | lf_fifo_test.c | 6 |
3 files changed, 7 insertions, 7 deletions
@@ -36,7 +36,7 @@ void lf_fifo_init( lf_fifo_t *q ) { } /* push a node at the tail of q */ -void lf_fifo_push_tail( lf_fifo_t *q, pointer_t *node ) { +void lf_fifo_push( lf_fifo_t *q, pointer_t *node ) { pointer_t tail; pointer_t last; pointer_t tmp; @@ -80,7 +80,7 @@ void lf_fifo_push_tail( lf_fifo_t *q, pointer_t *node ) { } /* pop a node from the head of q */ -pointer_t* pop_head( lf_fifo_t *q ) { +pointer_t* pop( lf_fifo_t *q ) { pointer_t head; pointer_t tail; pointer_t tmp; @@ -50,10 +50,10 @@ typedef struct queue { void lf_fifo_init( lf_fifo_t *q ); /* push a node at the tail of q */ -void lf_fifo_push_tail( lf_fifo_t *q, pointer_t *node ); +void lf_fifo_push( lf_fifo_t *q, pointer_t *node ); /* pop a node from the head of q */ -pointer_t* pop_head( lf_fifo_t *q ); +pointer_t* pop( lf_fifo_t *q ); # ifdef __cplusplus } diff --git a/lf_fifo_test.c b/lf_fifo_test.c index e212197..9d5a6bc 100644 --- a/lf_fifo_test.c +++ b/lf_fifo_test.c @@ -72,8 +72,8 @@ int main(int argc, char *argv[]) { /* check lf_fifo */ lf_fifo_init( &q); - printf("pop %X\n",(unsigned int)pop_head( &q )); - for(i=0; i<10; i++) lf_fifo_push_tail( &q, &data[i].link ); + printf("pop %X\n",(unsigned int)pop( &q )); + for(i=0; i<10; i++) lf_fifo_push( &q, &data[i].link ); it = (pointer_t*)q.head.split.next; while(it!=NULL) { @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) { } for(i=0; i<5; i++) { - it = pop_head( &q ); + it = pop( &q ); printf("pop %X %d\n",(unsigned int)it,container_of(it,struct node,link)->data); } it = (pointer_t*)q.head.split.next; |