Fix static linking: fix symbol name namespaces
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 1 Nov 2012 21:49:39 +0000 (17:49 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 1 Nov 2012 21:49:39 +0000 (17:49 -0400)
gp_futex, yield_active, rand_yield, has_sys_membarrier, rcu_defer_exit,
call_rcu_data_free, call_rcu_before_fork, call_rcu_after_fork_parent,
call_rcu_after_fork_child are exported by each urcu flavor.

In order to fix use-cases where multiple flavors are statically linked
into the same application, we need to move these symbols to local
namespaces.

Ensure that all symbols are prefixed by "rcu_".

Also add each of those symbols into urcu/map/*.h headers, so they get
mapped to their flavor-specific symbol name by the preprocessor.

This requires bumping our .so version from 1.0.0 to 2.0.0, because it
changes some symbol names.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
19 files changed:
configure.ac
tests/test_urcu.c
tests/test_urcu_assign.c
tests/test_urcu_bp.c
tests/test_urcu_defer.c
tests/test_urcu_gc.c
tests/test_urcu_hash_rw.c
tests/test_urcu_hash_unique.c
tests/test_urcu_qsbr.c
tests/test_urcu_qsbr_gc.c
urcu-bp.c
urcu-qsbr.c
urcu.c
urcu/map/urcu-bp.h
urcu/map/urcu-qsbr.h
urcu/map/urcu.h
urcu/static/urcu-bp.h
urcu/static/urcu-qsbr.h
urcu/static/urcu.h

index 33e8df799d2a3e13a8f55f1e4eb26fdeaaf964c7..4d0c7f4131dfcaadcaa679e70c4bde421de0704f 100644 (file)
@@ -6,7 +6,7 @@ AC_INIT([userspace-rcu],[0.7.4],[mathieu dot desnoyers at efficios dot com])
 
 # Following the numbering scheme proposed by libtool for the library version
 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
-AC_SUBST([URCU_LIBRARY_VERSION], [1:0:0])
+AC_SUBST([URCU_LIBRARY_VERSION], [2:0:0])
 
 AC_CONFIG_AUX_DIR([config])
 AC_CONFIG_MACRO_DIR([config])
index eed3dfbdcdc295c880e626eff8f5802a30356dda..373e1d2df397f0792e55c4be94dbc6e4639e2c80 100644 (file)
@@ -62,7 +62,7 @@ static inline pid_t gettid(void)
 #ifndef DYNAMIC_LINK_TEST
 #define _LGPL_SOURCE
 #else
-#define debug_yield_read()
+#define rcu_debug_yield_read()
 #endif
 #include <urcu.h>
 
@@ -238,7 +238,7 @@ void *thr_reader(void *_count)
        for (;;) {
                rcu_read_lock();
                local_ptr = rcu_dereference(test_rcu_pointer);
-               debug_yield_read();
+               rcu_debug_yield_read();
                if (local_ptr)
                        assert(local_ptr->a == 8);
                if (caa_unlikely(rduration))
@@ -354,10 +354,10 @@ int main(int argc, char **argv)
                switch (argv[i][1]) {
 #ifdef DEBUG_YIELD
                case 'r':
-                       yield_active |= YIELD_READ;
+                       rcu_yield_active |= RCU_YIELD_READ;
                        break;
                case 'w':
-                       yield_active |= YIELD_WRITE;
+                       rcu_yield_active |= RCU_YIELD_WRITE;
                        break;
 #endif
                case 'a':
index 68e84bd1f48273f365c9be49a1b35f0ba517a6d9..9e10225ad204d02efc3c39a7e7e35c91e95339e3 100644 (file)
@@ -62,7 +62,7 @@ static inline pid_t gettid(void)
 #ifndef DYNAMIC_LINK_TEST
 #define _LGPL_SOURCE
 #else
-#define debug_yield_read()
+#define rcu_debug_yield_read()
 #endif
 #include <urcu.h>
 
@@ -238,7 +238,7 @@ void *thr_reader(void *_count)
        for (;;) {
                rcu_read_lock();
                local_ptr = rcu_dereference(test_rcu_pointer);
-               debug_yield_read();
+               rcu_debug_yield_read();
                if (local_ptr)
                        assert(local_ptr->a == 8);
                if (caa_unlikely(rduration))
@@ -351,10 +351,10 @@ int main(int argc, char **argv)
                switch (argv[i][1]) {
 #ifdef DEBUG_YIELD
                case 'r':
-                       yield_active |= YIELD_READ;
+                       rcu_yield_active |= RCU_YIELD_READ;
                        break;
                case 'w':
-                       yield_active |= YIELD_WRITE;
+                       rcu_yield_active |= RCU_YIELD_WRITE;
                        break;
 #endif
                case 'a':
index afbc1a247691421dd5ce44962e41061e9efd8168..8ab0f5ac4cd900dab6867b32aef1ffbafcc93c35 100644 (file)
@@ -62,7 +62,7 @@ static inline pid_t gettid(void)
 #ifndef DYNAMIC_LINK_TEST
 #define _LGPL_SOURCE
 #else
-#define debug_yield_read()
+#define rcu_debug_yield_read()
 #endif
 #include <urcu-bp.h>
 
@@ -238,7 +238,7 @@ void *thr_reader(void *_count)
        for (;;) {
                rcu_read_lock();
                local_ptr = rcu_dereference(test_rcu_pointer);
-               debug_yield_read();
+               rcu_debug_yield_read();
                if (local_ptr)
                        assert(local_ptr->a == 8);
                if (caa_unlikely(rduration))
@@ -350,10 +350,10 @@ int main(int argc, char **argv)
                switch (argv[i][1]) {
 #ifdef DEBUG_YIELD
                case 'r':
-                       yield_active |= YIELD_READ;
+                       rcu_yield_active |= RCU_YIELD_READ;
                        break;
                case 'w':
-                       yield_active |= YIELD_WRITE;
+                       rcu_yield_active |= RCU_YIELD_WRITE;
                        break;
 #endif
                case 'a':
index 1fbb15461be45d96fc9626634fb4afc030b66524..8d030df807ad2abeffeb5580e715b020d39aeea0 100644 (file)
@@ -62,7 +62,7 @@ static inline pid_t gettid(void)
 #ifndef DYNAMIC_LINK_TEST
 #define _LGPL_SOURCE
 #else
-#define debug_yield_read()
+#define rcu_debug_yield_read()
 #endif
 #include <urcu.h>
 #include <urcu-defer.h>
@@ -209,7 +209,7 @@ void *thr_reader(void *_count)
        for (;;) {
                rcu_read_lock();
                local_ptr = rcu_dereference(test_rcu_pointer);
-               debug_yield_read();
+               rcu_debug_yield_read();
                if (local_ptr)
                        assert(local_ptr->a == 8);
                if (caa_unlikely(rduration))
@@ -340,10 +340,10 @@ int main(int argc, char **argv)
                switch (argv[i][1]) {
 #ifdef DEBUG_YIELD
                case 'r':
-                       yield_active |= YIELD_READ;
+                       rcu_yield_active |= RCU_YIELD_READ;
                        break;
                case 'w':
-                       yield_active |= YIELD_WRITE;
+                       rcu_yield_active |= RCU_YIELD_WRITE;
                        break;
 #endif
                case 'a':
index f8244238beb93acbf12f76f880e9efce76d4e522..d2c880653fccbcf0c5984b74117a91f10ce5365c 100644 (file)
@@ -62,7 +62,7 @@ static inline pid_t gettid(void)
 #ifndef DYNAMIC_LINK_TEST
 #define _LGPL_SOURCE
 #else
-#define debug_yield_read()
+#define rcu_debug_yield_read()
 #endif
 #include <urcu.h>
 
@@ -217,7 +217,7 @@ void *thr_reader(void *_count)
        for (;;) {
                rcu_read_lock();
                local_ptr = rcu_dereference(test_rcu_pointer);
-               debug_yield_read();
+               rcu_debug_yield_read();
                if (local_ptr)
                        assert(local_ptr->a == 8);
                if (caa_unlikely(rduration))
@@ -361,10 +361,10 @@ int main(int argc, char **argv)
                switch (argv[i][1]) {
 #ifdef DEBUG_YIELD
                case 'r':
-                       yield_active |= YIELD_READ;
+                       rcu_yield_active |= RCU_YIELD_READ;
                        break;
                case 'w':
-                       yield_active |= YIELD_WRITE;
+                       rcu_yield_active |= RCU_YIELD_WRITE;
                        break;
 #endif
                case 'a':
index a789236ecb0c67f875d1f8c0d17cbb28d429d7d4..3eb72924cd79a3d0651efbf7832198d9df8d1bb7 100644 (file)
@@ -92,7 +92,7 @@ void *test_hash_rw_thr_reader(void *_count)
                } else {
                        URCU_TLS(lookup_ok)++;
                }
-               debug_yield_read();
+               rcu_debug_yield_read();
                if (caa_unlikely(rduration))
                        loop_sleep(rduration);
                rcu_read_unlock();
index 610f479080e257e3460651a15281f53e33e4ba07..89e294327b1596ae634ccee507831b79d6bc7fcd 100644 (file)
@@ -95,7 +95,7 @@ void *test_hash_unique_thr_reader(void *_count)
                }
                rcu_read_unlock();
 
-               debug_yield_read();
+               rcu_debug_yield_read();
                if (caa_unlikely(rduration))
                        loop_sleep(rduration);
                URCU_TLS(nr_reads)++;
index 7f27038d2fbf8455f84aa25915698b818ed33088..2e3e44628ce9a2e9bab460ff3fb318d70df653c8 100644 (file)
@@ -62,7 +62,7 @@ static inline pid_t gettid(void)
 #ifndef DYNAMIC_LINK_TEST
 #define _LGPL_SOURCE
 #else
-#define debug_yield_read()
+#define rcu_debug_yield_read()
 #endif
 #include "urcu-qsbr.h"
 
@@ -237,7 +237,7 @@ void *thr_reader(void *_count)
        for (;;) {
                rcu_read_lock();
                local_ptr = rcu_dereference(test_rcu_pointer);
-               debug_yield_read();
+               rcu_debug_yield_read();
                if (local_ptr)
                        assert(local_ptr->a == 8);
                if (caa_unlikely(rduration))
@@ -357,10 +357,10 @@ int main(int argc, char **argv)
                switch (argv[i][1]) {
 #ifdef DEBUG_YIELD
                case 'r':
-                       yield_active |= YIELD_READ;
+                       rcu_yield_active |= RCU_RCU_YIELD_READ;
                        break;
                case 'w':
-                       yield_active |= YIELD_WRITE;
+                       rcu_yield_active |= RCU_RCU_YIELD_WRITE;
                        break;
 #endif
                case 'a':
index f8cf784ccd2a455c1afce76ec7dc7449cb671412..11668ee017e97f325ea9a9243e02d90aefbe24c7 100644 (file)
@@ -213,7 +213,7 @@ void *thr_reader(void *_count)
        for (;;) {
                _rcu_read_lock();
                local_ptr = _rcu_dereference(test_rcu_pointer);
-               debug_yield_read();
+               rcu_debug_yield_read();
                if (local_ptr)
                        assert(local_ptr->a == 8);
                if (caa_unlikely(rduration))
@@ -361,10 +361,10 @@ int main(int argc, char **argv)
                switch (argv[i][1]) {
 #ifdef DEBUG_YIELD
                case 'r':
-                       yield_active |= YIELD_READ;
+                       rcu_yield_active |= RCU_YIELD_READ;
                        break;
                case 'w':
-                       yield_active |= YIELD_WRITE;
+                       rcu_yield_active |= RCU_YIELD_WRITE;
                        break;
 #endif
                case 'a':
index 5dccbcd33c084032c9562b05ef9812404022ff9a..b07a1bbed912a5998c1089a2237825d2801f7032 100644 (file)
--- a/urcu-bp.c
+++ b/urcu-bp.c
@@ -105,8 +105,8 @@ void __attribute__((destructor)) rcu_bp_exit(void);
 static pthread_mutex_t rcu_gp_lock = PTHREAD_MUTEX_INITIALIZER;
 
 #ifdef DEBUG_YIELD
-unsigned int yield_active;
-DEFINE_URCU_TLS(unsigned int, rand_yield);
+unsigned int rcu_yield_active;
+DEFINE_URCU_TLS(unsigned int, rcu_rand_yield);
 #endif
 
 /*
index 19e68d24de96b263cc5108013e95183c4d0dc1df..c6a1b18a10a4f84a4d4e76d7b5b6bcdef4bcce6e 100644 (file)
@@ -53,7 +53,7 @@ void __attribute__((destructor)) rcu_exit(void);
 
 static pthread_mutex_t rcu_gp_lock = PTHREAD_MUTEX_INITIALIZER;
 
-int32_t gp_futex;
+int32_t rcu_gp_futex;
 
 /*
  * Global grace period counter.
@@ -72,8 +72,8 @@ unsigned long rcu_gp_ctr = RCU_GP_ONLINE;
 DEFINE_URCU_TLS(struct rcu_reader, rcu_reader);
 
 #ifdef DEBUG_YIELD
-unsigned int yield_active;
-DEFINE_URCU_TLS(unsigned int, rand_yield);
+unsigned int rcu_yield_active;
+DEFINE_URCU_TLS(unsigned int, rcu_rand_yield);
 #endif
 
 static CDS_LIST_HEAD(registry);
@@ -111,8 +111,8 @@ static void wait_gp(void)
 {
        /* Read reader_gp before read futex */
        cmm_smp_rmb();
-       if (uatomic_read(&gp_futex) == -1)
-               futex_noasync(&gp_futex, FUTEX_WAIT, -1,
+       if (uatomic_read(&rcu_gp_futex) == -1)
+               futex_noasync(&rcu_gp_futex, FUTEX_WAIT, -1,
                      NULL, NULL, 0);
 }
 
@@ -152,7 +152,7 @@ static void update_counter_and_wait(void)
        for (;;) {
                wait_loops++;
                if (wait_loops >= RCU_QS_ACTIVE_ATTEMPTS) {
-                       uatomic_set(&gp_futex, -1);
+                       uatomic_set(&rcu_gp_futex, -1);
                        /*
                         * Write futex before write waiting (the other side
                         * reads them in the opposite order).
@@ -173,7 +173,7 @@ static void update_counter_and_wait(void)
                        if (wait_loops >= RCU_QS_ACTIVE_ATTEMPTS) {
                                /* Read reader_gp before write futex */
                                cmm_smp_mb();
-                               uatomic_set(&gp_futex, 0);
+                               uatomic_set(&rcu_gp_futex, 0);
                        }
                        break;
                } else {
diff --git a/urcu.c b/urcu.c
index 42a5829fb894f513db3cae9f59f832e24ae0ca26..c42184656a3a0381b518aa15372b84a365400dea 100644 (file)
--- a/urcu.c
+++ b/urcu.c
@@ -63,7 +63,7 @@
 
 #ifdef RCU_MEMBARRIER
 static int init_done;
-int has_sys_membarrier;
+int rcu_has_sys_membarrier;
 
 void __attribute__((constructor)) rcu_init(void);
 #endif
@@ -83,7 +83,7 @@ void __attribute__((destructor)) rcu_exit(void);
 
 static pthread_mutex_t rcu_gp_lock = PTHREAD_MUTEX_INITIALIZER;
 
-int32_t gp_futex;
+int32_t rcu_gp_futex;
 
 /*
  * Global grace period counter.
@@ -100,8 +100,8 @@ unsigned long rcu_gp_ctr = RCU_GP_COUNT;
 DEFINE_URCU_TLS(struct rcu_reader, rcu_reader);
 
 #ifdef DEBUG_YIELD
-unsigned int yield_active;
-DEFINE_URCU_TLS(unsigned int, rand_yield);
+unsigned int rcu_yield_active;
+DEFINE_URCU_TLS(unsigned int, rcu_rand_yield);
 #endif
 
 static CDS_LIST_HEAD(registry);
@@ -140,7 +140,7 @@ static void mutex_unlock(pthread_mutex_t *mutex)
 #ifdef RCU_MEMBARRIER
 static void smp_mb_master(int group)
 {
-       if (caa_likely(has_sys_membarrier))
+       if (caa_likely(rcu_has_sys_membarrier))
                membarrier(MEMBARRIER_EXPEDITED);
        else
                cmm_smp_mb();
@@ -210,8 +210,8 @@ static void wait_gp(void)
 {
        /* Read reader_gp before read futex */
        smp_mb_master(RCU_MB_GROUP);
-       if (uatomic_read(&gp_futex) == -1)
-               futex_async(&gp_futex, FUTEX_WAIT, -1,
+       if (uatomic_read(&rcu_gp_futex) == -1)
+               futex_async(&rcu_gp_futex, FUTEX_WAIT, -1,
                      NULL, NULL, 0);
 }
 
@@ -246,7 +246,7 @@ static void update_counter_and_wait(void)
        for (;;) {
                wait_loops++;
                if (wait_loops == RCU_QS_ACTIVE_ATTEMPTS) {
-                       uatomic_dec(&gp_futex);
+                       uatomic_dec(&rcu_gp_futex);
                        /* Write futex before read reader_gp */
                        smp_mb_master(RCU_MB_GROUP);
                }
@@ -261,7 +261,7 @@ static void update_counter_and_wait(void)
                        if (wait_loops == RCU_QS_ACTIVE_ATTEMPTS) {
                                /* Read reader_gp before write futex */
                                smp_mb_master(RCU_MB_GROUP);
-                               uatomic_set(&gp_futex, 0);
+                               uatomic_set(&rcu_gp_futex, 0);
                        }
                        break;
                } else {
@@ -280,7 +280,7 @@ static void update_counter_and_wait(void)
                        if (wait_loops == RCU_QS_ACTIVE_ATTEMPTS) {
                                /* Read reader_gp before write futex */
                                smp_mb_master(RCU_MB_GROUP);
-                               uatomic_set(&gp_futex, 0);
+                               uatomic_set(&rcu_gp_futex, 0);
                        }
                        break;
                } else {
@@ -389,7 +389,7 @@ void rcu_init(void)
                return;
        init_done = 1;
        if (!membarrier(MEMBARRIER_EXPEDITED | MEMBARRIER_QUERY))
-               has_sys_membarrier = 1;
+               rcu_has_sys_membarrier = 1;
 }
 #endif
 
index 16601a1f7f842c6703a10cb63bffe784f5afc2b1..63582fd3fe5b6c9f34c66991c14355650c1ba73b 100644 (file)
@@ -45,6 +45,7 @@
 #define synchronize_rcu                        synchronize_rcu_bp
 #define rcu_reader                     rcu_reader_bp
 #define rcu_gp_ctr                     rcu_gp_ctr_bp
+#define rcu_gp_futex                   rcu_gp_futex_bp /* unused */
 
 #define get_cpu_call_rcu_data          get_cpu_call_rcu_data_bp
 #define get_call_rcu_thread            get_call_rcu_thread_bp
 #define create_all_cpu_call_rcu_data   create_all_cpu_call_rcu_data_bp
 #define free_all_cpu_call_rcu_data     free_all_cpu_call_rcu_data_bp
 #define call_rcu                       call_rcu_bp
+#define call_rcu_data_free             call_rcu_data_free_bp
+#define call_rcu_before_fork           call_rcu_before_fork_bp
+#define call_rcu_after_fork_parent     call_rcu_after_fork_parent_bp
+#define call_rcu_after_fork_child      call_rcu_after_fork_child_bp
 
 #define defer_rcu                      defer_rcu_bp
 #define rcu_defer_register_thread      rcu_defer_register_thread_bp
 #define rcu_defer_unregister_thread    rcu_defer_unregister_thread_bp
 #define rcu_defer_barrier              rcu_defer_barrier_bp
 #define rcu_defer_barrier_thread       rcu_defer_barrier_thread_bp
+#define rcu_defer_exit                 rcu_defer_exit_bp
 
 #define rcu_flavor                     rcu_flavor_bp
 
+#define rcu_yield_active               rcu_yield_active_bp
+#define rcu_rand_yield                 rcu_rand_yield_bp
+
 #endif /* _URCU_BP_MAP_H */
index a95441d2d36206b2a61b5e22097e615de76d819f..f0aecc992da5de97e391b2378ae24489985f194f 100644 (file)
@@ -48,6 +48,7 @@
 #define synchronize_rcu                        synchronize_rcu_qsbr
 #define rcu_reader                     rcu_reader_qsbr
 #define rcu_gp_ctr                     rcu_gp_ctr_qsbr
+#define rcu_gp_futex                   rcu_gp_futex_qsbr
 
 #define get_cpu_call_rcu_data          get_cpu_call_rcu_data_qsbr
 #define get_call_rcu_thread            get_call_rcu_thread_qsbr
 #define set_thread_call_rcu_data       set_thread_call_rcu_data_qsbr
 #define create_all_cpu_call_rcu_data   create_all_cpu_call_rcu_data_qsbr
 #define call_rcu                       call_rcu_qsbr
+#define call_rcu_data_free             call_rcu_data_free_qsbr
+#define call_rcu_before_fork           call_rcu_before_fork_qsbr
+#define call_rcu_after_fork_parent     call_rcu_after_fork_parent_qsbr
+#define call_rcu_after_fork_child      call_rcu_after_fork_child_qsbr
 
 #define defer_rcu                      defer_rcu_qsbr
 #define rcu_defer_register_thread      rcu_defer_register_thread_qsbr
 #define rcu_defer_unregister_thread    rcu_defer_unregister_thread_qsbr
 #define        rcu_defer_barrier               rcu_defer_barrier_qsbr
 #define rcu_defer_barrier_thread       rcu_defer_barrier_thread_qsbr
+#define rcu_defer_exit                 rcu_defer_exit_qsbr
 
 #define rcu_flavor                     rcu_flavor_qsbr
 
+#define rcu_yield_active               rcu_yield_active_memb_qsbr
+#define rcu_rand_yield                 rcu_rand_yield_memb_qsbr
+
 #endif /* _URCU_QSBR_MAP_H */
index dd7a6914b93f5c2325dae840824b89d1790b2259..759cb4108a8c8cb2787813a518e4362e19acc274 100644 (file)
@@ -76,6 +76,7 @@
 #define synchronize_rcu                        synchronize_rcu_memb
 #define rcu_reader                     rcu_reader_memb
 #define rcu_gp_ctr                     rcu_gp_ctr_memb
+#define rcu_gp_futex                   rcu_gp_futex_memb
 
 #define get_cpu_call_rcu_data          get_cpu_call_rcu_data_memb
 #define get_call_rcu_thread            get_call_rcu_thread_memb
 #define create_all_cpu_call_rcu_data   create_all_cpu_call_rcu_data_memb
 #define free_all_cpu_call_rcu_data     free_all_cpu_call_rcu_data_memb
 #define call_rcu                       call_rcu_memb
+#define call_rcu_data_free             call_rcu_data_free_memb
+#define call_rcu_before_fork           call_rcu_before_fork_memb
+#define call_rcu_after_fork_parent     call_rcu_after_fork_parent_memb
+#define call_rcu_after_fork_child      call_rcu_after_fork_child_memb
 
 #define defer_rcu                      defer_rcu_memb
 #define rcu_defer_register_thread      rcu_defer_register_thread_memb
 #define rcu_defer_unregister_thread    rcu_defer_unregister_thread_memb
 #define rcu_defer_barrier              rcu_defer_barrier_memb
 #define rcu_defer_barrier_thread       rcu_defer_barrier_thread_memb
+#define rcu_defer_exit                 rcu_defer_exit_memb
 
 #define rcu_flavor                     rcu_flavor_memb
 
+#define rcu_yield_active               rcu_yield_active_memb
+#define rcu_rand_yield                 rcu_rand_yield_memb
+
+/* Specific to MEMBARRIER flavor */
+#define rcu_has_sys_membarrier         rcu_has_sys_membarrier_memb
+
 #elif defined(RCU_SIGNAL)
 
 #define rcu_read_lock                  rcu_read_lock_sig
 #define synchronize_rcu                        synchronize_rcu_sig
 #define rcu_reader                     rcu_reader_sig
 #define rcu_gp_ctr                     rcu_gp_ctr_sig
+#define rcu_gp_futex                   rcu_gp_futex_sig
 
 #define get_cpu_call_rcu_data          get_cpu_call_rcu_data_sig
 #define get_call_rcu_thread            get_call_rcu_thread_sig
 #define create_all_cpu_call_rcu_data   create_all_cpu_call_rcu_data_sig
 #define free_all_cpu_call_rcu_data     free_all_cpu_call_rcu_data_sig
 #define call_rcu                       call_rcu_sig
+#define call_rcu_data_free             call_rcu_data_free_sig
+#define call_rcu_before_fork           call_rcu_before_fork_sig
+#define call_rcu_after_fork_parent     call_rcu_after_fork_parent_sig
+#define call_rcu_after_fork_child      call_rcu_after_fork_child_sig
 
 #define defer_rcu                      defer_rcu_sig
 #define rcu_defer_register_thread      rcu_defer_register_thread_sig
 #define rcu_defer_unregister_thread    rcu_defer_unregister_thread_sig
 #define rcu_defer_barrier              rcu_defer_barrier_sig
 #define rcu_defer_barrier_thread       rcu_defer_barrier_thread_sig
+#define rcu_defer_exit                 rcu_defer_exit_sig
 
 #define rcu_flavor                     rcu_flavor_sig
 
+#define rcu_yield_active               rcu_yield_active_sig
+#define rcu_rand_yield                 rcu_rand_yield_sig
+
 #elif defined(RCU_MB)
 
 #define rcu_read_lock                  rcu_read_lock_mb
 #define synchronize_rcu                        synchronize_rcu_mb
 #define rcu_reader                     rcu_reader_mb
 #define rcu_gp_ctr                     rcu_gp_ctr_mb
+#define rcu_gp_futex                   rcu_gp_futex_mb
 
 #define get_cpu_call_rcu_data          get_cpu_call_rcu_data_mb
 #define get_call_rcu_thread            get_call_rcu_thread_mb
 #define create_all_cpu_call_rcu_data   create_all_cpu_call_rcu_data_mb
 #define free_all_cpu_call_rcu_data     free_all_cpu_call_rcu_data_mb
 #define call_rcu                       call_rcu_mb
+#define call_rcu_data_free             call_rcu_data_free_mb
+#define call_rcu_before_fork           call_rcu_before_fork_mb
+#define call_rcu_after_fork_parent     call_rcu_after_fork_parent_mb
+#define call_rcu_after_fork_child      call_rcu_after_fork_child_mb
 
 #define defer_rcu                      defer_rcu_mb
 #define rcu_defer_register_thread      rcu_defer_register_thread_mb
 #define rcu_defer_unregister_thread    rcu_defer_unregister_thread_mb
 #define rcu_defer_barrier              rcu_defer_barrier_mb
 #define rcu_defer_barrier_thread       rcu_defer_barrier_thread_mb
+#define rcu_defer_exit                 rcu_defer_exit_mb
 
 #define rcu_flavor                     rcu_flavor_mb
 
+#define rcu_yield_active               rcu_yield_active_mb
+#define rcu_rand_yield                 rcu_rand_yield_mb
+
 #else
 
 #error "Undefined selection"
index a2f73687d0a1995e5b3207b9f3fd3b970499d961..6187bd31b5325fb292057e95f7236285cb846019 100644 (file)
@@ -64,8 +64,8 @@ extern "C" {
 #include <pthread.h>
 #include <unistd.h>
 
-#define YIELD_READ     (1 << 0)
-#define YIELD_WRITE    (1 << 1)
+#define RCU_YIELD_READ         (1 << 0)
+#define RCU_YIELD_WRITE        (1 << 1)
 
 /*
  * Updates without RCU_MB are much slower. Account this in
@@ -74,37 +74,37 @@ extern "C" {
 /* maximum sleep delay, in us */
 #define MAX_SLEEP 50
 
-extern unsigned int yield_active;
-extern DECLARE_URCU_TLS(unsigned int, rand_yield);
+extern unsigned int rcu_yield_active;
+extern DECLARE_URCU_TLS(unsigned int, rcu_rand_yield);
 
-static inline void debug_yield_read(void)
+static inline void rcu_debug_yield_read(void)
 {
-       if (yield_active & YIELD_READ)
-               if (rand_r(&URCU_TLS(rand_yield)) & 0x1)
-                       usleep(rand_r(&URCU_TLS(rand_yield)) % MAX_SLEEP);
+       if (rcu_yield_active & RCU_YIELD_READ)
+               if (rand_r(&URCU_TLS(rcu_rand_yield)) & 0x1)
+                       usleep(rand_r(&URCU_TLS(rcu_rand_yield)) % MAX_SLEEP);
 }
 
-static inline void debug_yield_write(void)
+static inline void rcu_debug_yield_write(void)
 {
-       if (yield_active & YIELD_WRITE)
-               if (rand_r(&URCU_TLS(rand_yield)) & 0x1)
-                       usleep(rand_r(&URCU_TLS(rand_yield)) % MAX_SLEEP);
+       if (rcu_yield_active & RCU_YIELD_WRITE)
+               if (rand_r(&URCU_TLS(rcu_rand_yield)) & 0x1)
+                       usleep(rand_r(&URCU_TLS(rcu_rand_yield)) % MAX_SLEEP);
 }
 
-static inline void debug_yield_init(void)
+static inline void rcu_debug_yield_init(void)
 {
-       URCU_TLS(rand_yield) = time(NULL) ^ pthread_self();
+       URCU_TLS(rcu_rand_yield) = time(NULL) ^ pthread_self();
 }
 #else
-static inline void debug_yield_read(void)
+static inline void rcu_debug_yield_read(void)
 {
 }
 
-static inline void debug_yield_write(void)
+static inline void rcu_debug_yield_write(void)
 {
 }
 
-static inline void debug_yield_init(void)
+static inline void rcu_debug_yield_init(void)
 {
 
 }
index 5580092f4159123f3d948e85b5384b0e58c7a27c..8b16a4abc4586783fd5a267126e43063050f58f6 100644 (file)
@@ -68,43 +68,43 @@ extern "C" {
 #include <pthread.h>
 #include <unistd.h>
 
-#define YIELD_READ     (1 << 0)
-#define YIELD_WRITE    (1 << 1)
+#define RCU_YIELD_READ         (1 << 0)
+#define RCU_YIELD_WRITE        (1 << 1)
 
 /* maximum sleep delay, in us */
 #define MAX_SLEEP 50
 
-extern unsigned int yield_active;
-extern DECLARE_URCU_TLS(unsigned int, rand_yield);
+extern unsigned int rcu_yield_active;
+extern DECLARE_URCU_TLS(unsigned int, rcu_rand_yield);
 
-static inline void debug_yield_read(void)
+static inline void rcu_debug_yield_read(void)
 {
-       if (yield_active & YIELD_READ)
-               if (rand_r(&URCU_TLS(rand_yield)) & 0x1)
-                       usleep(rand_r(&URCU_TLS(rand_yield)) % MAX_SLEEP);
+       if (rcu_yield_active & RCU_YIELD_READ)
+               if (rand_r(&URCU_TLS(rcu_rand_yield)) & 0x1)
+                       usleep(rand_r(&URCU_TLS(rcu_rand_yield)) % MAX_SLEEP);
 }
 
-static inline void debug_yield_write(void)
+static inline void rcu_debug_yield_write(void)
 {
-       if (yield_active & YIELD_WRITE)
-               if (rand_r(&URCU_TLS(rand_yield)) & 0x1)
-                       usleep(rand_r(&URCU_TLS(rand_yield)) % MAX_SLEEP);
+       if (rcu_yield_active & RCU_YIELD_WRITE)
+               if (rand_r(&URCU_TLS(rcu_rand_yield)) & 0x1)
+                       usleep(rand_r(&URCU_TLS(rcu_rand_yield)) % MAX_SLEEP);
 }
 
-static inline void debug_yield_init(void)
+static inline void rcu_debug_yield_init(void)
 {
-       URCU_TLS(rand_yield) = time(NULL) ^ pthread_self();
+       URCU_TLS(rcu_rand_yield) = time(NULL) ^ pthread_self();
 }
 #else
-static inline void debug_yield_read(void)
+static inline void rcu_debug_yield_read(void)
 {
 }
 
-static inline void debug_yield_write(void)
+static inline void rcu_debug_yield_write(void)
 {
 }
 
-static inline void debug_yield_init(void)
+static inline void rcu_debug_yield_init(void)
 {
 
 }
@@ -131,7 +131,7 @@ struct rcu_reader {
 
 extern DECLARE_URCU_TLS(struct rcu_reader, rcu_reader);
 
-extern int32_t gp_futex;
+extern int32_t rcu_gp_futex;
 
 /*
  * Wake-up waiting synchronize_rcu(). Called from many concurrent threads.
@@ -141,10 +141,10 @@ static inline void wake_up_gp(void)
        if (caa_unlikely(_CMM_LOAD_SHARED(URCU_TLS(rcu_reader).waiting))) {
                _CMM_STORE_SHARED(URCU_TLS(rcu_reader).waiting, 0);
                cmm_smp_mb();
-               if (uatomic_read(&gp_futex) != -1)
+               if (uatomic_read(&rcu_gp_futex) != -1)
                        return;
-               uatomic_set(&gp_futex, 0);
-               futex_noasync(&gp_futex, FUTEX_WAKE, 1,
+               uatomic_set(&rcu_gp_futex, 0);
+               futex_noasync(&rcu_gp_futex, FUTEX_WAKE, 1,
                      NULL, NULL, 0);
        }
 }
index c517693ff1cf187982882bf30f412e454ae8d26f..f32f300e599d95b922cbf043cc3a839e234190d5 100644 (file)
@@ -108,8 +108,8 @@ extern "C" {
 #include <pthread.h>
 #include <unistd.h>
 
-#define YIELD_READ     (1 << 0)
-#define YIELD_WRITE    (1 << 1)
+#define RCU_YIELD_READ         (1 << 0)
+#define RCU_YIELD_WRITE        (1 << 1)
 
 /*
  * Updates with RCU_SIGNAL are much slower. Account this in the delay.
@@ -121,37 +121,37 @@ extern "C" {
 #define MAX_SLEEP 50
 #endif
 
-extern unsigned int yield_active;
-extern DECLARE_URCU_TLS(unsigned int, rand_yield);
+extern unsigned int rcu_yield_active;
+extern DECLARE_URCU_TLS(unsigned int, rcu_rand_yield);
 
-static inline void debug_yield_read(void)
+static inline void rcu_debug_yield_read(void)
 {
-       if (yield_active & YIELD_READ)
-               if (rand_r(&URCU_TLS(rand_yield)) & 0x1)
-                       usleep(rand_r(&URCU_TLS(rand_yield)) % MAX_SLEEP);
+       if (rcu_yield_active & RCU_YIELD_READ)
+               if (rand_r(&URCU_TLS(rcu_rand_yield)) & 0x1)
+                       usleep(rand_r(&URCU_TLS(rcu_rand_yield)) % MAX_SLEEP);
 }
 
-static inline void debug_yield_write(void)
+static inline void rcu_debug_yield_write(void)
 {
-       if (yield_active & YIELD_WRITE)
-               if (rand_r(&URCU_TLS(rand_yield)) & 0x1)
-                       usleep(rand_r(&URCU_TLS(rand_yield)) % MAX_SLEEP);
+       if (rcu_yield_active & RCU_YIELD_WRITE)
+               if (rand_r(&URCU_TLS(rcu_rand_yield)) & 0x1)
+                       usleep(rand_r(&URCU_TLS(rcu_rand_yield)) % MAX_SLEEP);
 }
 
-static inline void debug_yield_init(void)
+static inline void rcu_debug_yield_init(void)
 {
-       URCU_TLS(rand_yield) = time(NULL) ^ (unsigned long) pthread_self();
+       URCU_TLS(rcu_rand_yield) = time(NULL) ^ (unsigned long) pthread_self();
 }
 #else
-static inline void debug_yield_read(void)
+static inline void rcu_debug_yield_read(void)
 {
 }
 
-static inline void debug_yield_write(void)
+static inline void rcu_debug_yield_write(void)
 {
 }
 
-static inline void debug_yield_init(void)
+static inline void rcu_debug_yield_init(void)
 {
 
 }
@@ -173,11 +173,11 @@ static inline void debug_yield_init(void)
 #define RCU_MB_GROUP           MB_GROUP_ALL
 
 #ifdef RCU_MEMBARRIER
-extern int has_sys_membarrier;
+extern int rcu_has_sys_membarrier;
 
 static inline void smp_mb_slave(int group)
 {
-       if (caa_likely(has_sys_membarrier))
+       if (caa_likely(rcu_has_sys_membarrier))
                cmm_barrier();
        else
                cmm_smp_mb();
@@ -225,16 +225,16 @@ struct rcu_reader {
 
 extern DECLARE_URCU_TLS(struct rcu_reader, rcu_reader);
 
-extern int32_t gp_futex;
+extern int32_t rcu_gp_futex;
 
 /*
  * Wake-up waiting synchronize_rcu(). Called from many concurrent threads.
  */
 static inline void wake_up_gp(void)
 {
-       if (caa_unlikely(uatomic_read(&gp_futex) == -1)) {
-               uatomic_set(&gp_futex, 0);
-               futex_async(&gp_futex, FUTEX_WAKE, 1,
+       if (caa_unlikely(uatomic_read(&rcu_gp_futex) == -1)) {
+               uatomic_set(&rcu_gp_futex, 0);
+               futex_async(&rcu_gp_futex, FUTEX_WAKE, 1,
                      NULL, NULL, 0);
        }
 }
This page took 0.043262 seconds and 4 git commands to generate.