X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu%2Fwfstack-static.h;h=cecdde1c6551b42e65ac6d2543755dae08c7ed5a;hp=0acb4f0a3894cf77f0efb6795c40a11356f7ce52;hb=16aa9ee87cf4364921c36025359be01390338d87;hpb=06f22bdbb0c4c4d5db42a2e2dc35818aa61415be diff --git a/urcu/wfstack-static.h b/urcu/wfstack-static.h index 0acb4f0..cecdde1 100644 --- a/urcu/wfstack-static.h +++ b/urcu/wfstack-static.h @@ -35,27 +35,27 @@ extern "C" { #endif -#define WF_STACK_END ((void *)0x1UL) -#define WFS_ADAPT_ATTEMPTS 10 /* Retry if being set */ -#define WFS_WAIT 10 /* Wait 10 ms if being set */ +#define CDS_WF_STACK_END ((void *)0x1UL) +#define CDS_WFS_ADAPT_ATTEMPTS 10 /* Retry if being set */ +#define CDS_WFS_WAIT 10 /* Wait 10 ms if being set */ -void _wfs_node_init(struct wfs_node *node) +void _cds_wfs_node_init(struct cds_wfs_node *node) { node->next = NULL; } -void _wfs_init(struct wfs_stack *s) +void _cds_wfs_init(struct cds_wfs_stack *s) { int ret; - s->head = WF_STACK_END; + s->head = CDS_WF_STACK_END; ret = pthread_mutex_init(&s->lock, NULL); assert(!ret); } -void _wfs_push(struct wfs_stack *s, struct wfs_node *node) +void _cds_wfs_push(struct cds_wfs_stack *s, struct cds_wfs_node *node) { - struct wfs_node *old_head; + struct cds_wfs_node *old_head; assert(node->next == NULL); /* @@ -73,22 +73,22 @@ void _wfs_push(struct wfs_stack *s, struct wfs_node *node) /* * Returns NULL if stack is empty. */ -struct wfs_node * -___wfs_pop_blocking(struct wfs_stack *s) +struct cds_wfs_node * +___cds_wfs_pop_blocking(struct cds_wfs_stack *s) { - struct wfs_node *head, *next; + struct cds_wfs_node *head, *next; int attempt = 0; retry: head = CAA_LOAD_SHARED(s->head); - if (head == WF_STACK_END) + if (head == CDS_WF_STACK_END) return NULL; /* * Adaptative busy-looping waiting for push to complete. */ while ((next = CAA_LOAD_SHARED(head->next)) == NULL) { - if (++attempt >= WFS_ADAPT_ATTEMPTS) { - poll(NULL, 0, WFS_WAIT); /* Wait for 10ms */ + if (++attempt >= CDS_WFS_ADAPT_ATTEMPTS) { + poll(NULL, 0, CDS_WFS_WAIT); /* Wait for 10ms */ attempt = 0; } else caa_cpu_relax(); @@ -99,15 +99,15 @@ retry: goto retry; /* Concurrent modification. Retry. */ } -struct wfs_node * -_wfs_pop_blocking(struct wfs_stack *s) +struct cds_wfs_node * +_cds_wfs_pop_blocking(struct cds_wfs_stack *s) { - struct wfs_node *retnode; + struct cds_wfs_node *retnode; int ret; ret = pthread_mutex_lock(&s->lock); assert(!ret); - retnode = ___wfs_pop_blocking(s); + retnode = ___cds_wfs_pop_blocking(s); ret = pthread_mutex_unlock(&s->lock); assert(!ret); return retnode;