Restrict supported arch ot P6+ on Intel x86 32.
[urcu.git] / urcu-defer-static.h
index 7d0ed52cf88b624d5a236a5a35c3d1f8920ef661..b27cfe156b6c99d3dc8ec0ef4a14540601632a21 100644 (file)
 #include <stdlib.h>
 #include <pthread.h>
 
-#include <compiler.h>
-#include <arch.h>
+#include <urcu/compiler.h>
+#include <urcu/arch.h>
+#include <urcu/uatomic_arch.h>
+#include <urcu/list.h>
 
 
 /*
@@ -120,71 +122,9 @@ struct defer_queue {
        unsigned long tail;     /* next element to remove at tail */
        void *last_fct_out;     /* last fct pointer encoded */
        void **q;
+       /* registry information */
+       unsigned long last_head;
+       struct list_head list;  /* list of thread queues */
 };
 
-extern struct defer_queue __thread defer_queue;
-
-extern void rcu_defer_barrier_thread(void);
-
-/*
- * not signal-safe.
- */
-static inline void _rcu_defer_queue(void (*fct)(void *p), void *p)
-{
-       unsigned long head, tail;
-
-       /*
-        * Head is only modified by ourself. Tail can be modified by reclamation
-        * thread.
-        */
-       head = defer_queue.head;
-       tail = LOAD_SHARED(defer_queue.tail);
-
-       /*
-        * If queue is full, empty it ourself.
-        * Worse-case: must allow 2 supplementary entries for fct pointer.
-        */
-       if (unlikely(head - tail >= DEFER_QUEUE_SIZE - 2)) {
-               assert(head - tail <= DEFER_QUEUE_SIZE);
-               rcu_defer_barrier_thread();
-               assert(head - LOAD_SHARED(defer_queue.tail) == 0);
-       }
-
-       smp_wmb();      /* Publish new pointer before write q[] */
-       if (unlikely(defer_queue.last_fct_in != fct)) {
-               //printf("fct diff %p %p\n", defer_queue.last_fct, fct);
-               defer_queue.last_fct_in = fct;
-               if (unlikely(DQ_IS_FCT_BIT(fct) || fct == DQ_FCT_MARK)) {
-                       /*
-                        * If the function to encode is not aligned or the
-                        * marker, write DQ_FCT_MARK followed by the function
-                        * pointer.
-                        */
-                       _STORE_SHARED(defer_queue.q[head++ & DEFER_QUEUE_MASK],
-                                     DQ_FCT_MARK);
-                       _STORE_SHARED(defer_queue.q[head++ & DEFER_QUEUE_MASK],
-                                     fct);
-               } else {
-                       DQ_SET_FCT_BIT(fct);
-                       _STORE_SHARED(defer_queue.q[head++ & DEFER_QUEUE_MASK],
-                                     fct);
-               }
-       } else {
-               //printf("fct same %p\n", fct);
-               if (unlikely(DQ_IS_FCT_BIT(p) || p == DQ_FCT_MARK)) {
-                       /*
-                        * If the data to encode is not aligned or the marker,
-                        * write DQ_FCT_MARK followed by the function pointer.
-                        */
-                       _STORE_SHARED(defer_queue.q[head++ & DEFER_QUEUE_MASK],
-                                     DQ_FCT_MARK);
-                       _STORE_SHARED(defer_queue.q[head++ & DEFER_QUEUE_MASK],
-                                     fct);
-               }
-       }
-       _STORE_SHARED(defer_queue.q[head++ & DEFER_QUEUE_MASK], p);
-       smp_wmb();      /* Write q[] before head. */
-       STORE_SHARED(defer_queue.head, head);
-}
-
 #endif /* _URCU_DEFER_STATIC_H */
This page took 0.02306 seconds and 4 git commands to generate.