Add call_rcu() interface
[urcu.git] / urcu / wfstack-static.h
index 3f44743461ab1317c069829132e399fbc88d48eb..ff18c4a3f213214188ef6bfe6f6c98a795132bab 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <pthread.h>
 #include <assert.h>
+#include <poll.h>
 #include <urcu/compiler.h>
 #include <urcu/uatomic_arch.h>
 
 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);
        /*
@@ -67,31 +68,31 @@ void _wfs_push(struct wfs_stack *s, struct wfs_node *node)
         * At this point, dequeuers see a NULL node->next, they should busy-wait
         * until node->next is set to old_head.
         */
-       STORE_SHARED(node->next, old_head);
+       CMM_STORE_SHARED(node->next, old_head);
 }
 
 /*
  * 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 = LOAD_SHARED(s->head);
-       if (head == WF_STACK_END)
+       head = CMM_LOAD_SHARED(s->head);
+       if (head == CDS_WF_STACK_END)
                return NULL;
        /*
         * Adaptative busy-looping waiting for push to complete.
         */
-       while ((next = LOAD_SHARED(head->next)) == NULL) {
-               if (++attempt >= WFS_ADAPT_ATTEMPTS) {
-                       poll(NULL, 0, WFS_WAIT);        /* Wait for 10ms */
+       while ((next = CMM_LOAD_SHARED(head->next)) == NULL) {
+               if (++attempt >= CDS_WFS_ADAPT_ATTEMPTS) {
+                       poll(NULL, 0, CDS_WFS_WAIT);    /* Wait for 10ms */
                        attempt = 0;
                } else
-                       cpu_relax();
+                       caa_cpu_relax();
        }
        if (uatomic_cmpxchg(&s->head, head, next) == head)
                return head;
@@ -99,15 +100,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;
This page took 0.024656 seconds and 4 git commands to generate.