X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu.c;h=69ebcaa9cb0fbfa07a264ab94fa5261513c72424;hp=b3f94da9a2b733e30c08eb014c095933e2e13561;hb=9ba261bd496f2dfac38a16e341259553335dd165;hpb=4de0cd31491bcb93a19c14fc1eb2a2a23ce12855 diff --git a/urcu.c b/urcu.c index b3f94da..69ebcaa 100644 --- a/urcu.c +++ b/urcu.c @@ -62,6 +62,24 @@ */ #define RCU_QS_ACTIVE_ATTEMPTS 100 +/* + * RCU_MEMBARRIER is only possibly available on Linux. + */ +#if defined(RCU_MEMBARRIER) && defined(__linux__) +#include +#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(®istry)); + /* + * 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(®istry)); + */ } #endif /* #ifdef RCU_SIGNAL */