Add missing tests/common/Makefile.am
[urcu.git] / urcu.c
diff --git a/urcu.c b/urcu.c
index b3f94da9a2b733e30c08eb014c095933e2e13561..759b94bdb9e9550e178caa04904e6048c7810b2c 100644 (file)
--- a/urcu.c
+++ b/urcu.c
  */
 #define RCU_QS_ACTIVE_ATTEMPTS 100
 
+/*
+ * RCU_MEMBARRIER is only possibly available on Linux.
+ */
+#if defined(RCU_MEMBARRIER) && defined(__linux__)
+#include <syscall.h>
+#endif
+
+/* If the headers do not support SYS_membarrier, fall back on RCU_MB */
+#ifdef SYS_membarrier
+# define membarrier(...)               syscall(SYS_membarrier, __VA_ARGS__)
+#else
+# define membarrier(...)               -ENOSYS
+#endif
+
+#define MEMBARRIER_EXPEDITED           (1 << 0)
+#define MEMBARRIER_DELAYED             (1 << 1)
+#define MEMBARRIER_QUERY               (1 << 16)
+
 #ifdef RCU_MEMBARRIER
 static int init_done;
 int rcu_has_sys_membarrier;
@@ -139,7 +157,7 @@ static void mutex_unlock(pthread_mutex_t *mutex)
 static void smp_mb_master(int group)
 {
        if (caa_likely(rcu_has_sys_membarrier))
-               membarrier(MEMBARRIER_EXPEDITED);
+               (void) membarrier(MEMBARRIER_EXPEDITED);
        else
                cmm_smp_mb();
 }
@@ -495,14 +513,14 @@ void rcu_init(void)
 
 void rcu_exit(void)
 {
-       struct sigaction act;
-       int ret;
-
-       ret = sigaction(SIGRCU, NULL, &act);
-       if (ret)
-               urcu_die(errno);
-       assert(act.sa_sigaction == sigrcu_handler);
-       assert(cds_list_empty(&registry));
+       /*
+        * Don't unregister the SIGRCU signal handler anymore, because
+        * call_rcu threads could still be using it shortly before the
+        * application exits.
+        * Assertion disabled because call_rcu threads are now rcu
+        * readers, and left running at exit.
+        * assert(cds_list_empty(&registry));
+        */
 }
 
 #endif /* #ifdef RCU_SIGNAL */
This page took 0.022591 seconds and 4 git commands to generate.