*/
#define _BSD_SOURCE
+#define _GNU_SOURCE
+#define _LGPL_SOURCE
#include <stdio.h>
#include <pthread.h>
#include <signal.h>
#include <assert.h>
#include <stdlib.h>
+#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <poll.h>
-#include "urcu-static.h"
+#include "urcu/wfqueue.h"
+#include "urcu/map/urcu.h"
+#include "urcu/static/urcu.h"
+#include "urcu-pointer.h"
+
/* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */
+#undef _LGPL_SOURCE
#include "urcu.h"
+#define _LGPL_SOURCE
+
+/*
+ * If a reader is really non-cooperative and refuses to commit its
+ * rcu_active_readers count to memory (there is no barrier in the reader
+ * per-se), kick it after a few loops waiting for it.
+ */
+#define KICK_READER_LOOPS 10000
+
+/*
+ * Active attempts to check for reader Q.S. before calling futex().
+ */
+#define RCU_QS_ACTIVE_ATTEMPTS 100
#ifdef RCU_MEMBARRIER
static int init_done;
static pthread_mutex_t rcu_gp_lock = PTHREAD_MUTEX_INITIALIZER;
-int gp_futex;
+int32_t gp_futex;
/*
* Global grace period counter.
perror("Error in pthread mutex lock");
exit(-1);
}
- if (CAA_LOAD_SHARED(rcu_reader.need_mb)) {
+ if (CMM_LOAD_SHARED(rcu_reader.need_mb)) {
cmm_smp_mb();
- _CAA_STORE_SHARED(rcu_reader.need_mb, 0);
+ _CMM_STORE_SHARED(rcu_reader.need_mb, 0);
cmm_smp_mb();
}
poll(NULL,0,10);
#ifdef RCU_MEMBARRIER
static void smp_mb_master(int group)
{
- if (likely(has_sys_membarrier))
+ if (caa_likely(has_sys_membarrier))
membarrier(MEMBARRIER_EXPEDITED);
else
cmm_smp_mb();
* cache flush is enforced.
*/
cds_list_for_each_entry(index, ®istry, node) {
- CAA_STORE_SHARED(index->need_mb, 1);
+ CMM_STORE_SHARED(index->need_mb, 1);
pthread_kill(index->tid, SIGRCU);
}
/*
* the Linux Test Project (LTP).
*/
cds_list_for_each_entry(index, ®istry, node) {
- while (CAA_LOAD_SHARED(index->need_mb)) {
+ while (CMM_LOAD_SHARED(index->need_mb)) {
pthread_kill(index->tid, SIGRCU);
poll(NULL, 0, 1);
}
struct rcu_reader *index, *tmp;
/* Switch parity: 0 -> 1, 1 -> 0 */
- CAA_STORE_SHARED(rcu_gp_ctr, rcu_gp_ctr ^ RCU_GP_CTR_PHASE);
+ CMM_STORE_SHARED(rcu_gp_ctr, rcu_gp_ctr ^ RCU_GP_CTR_PHASE);
/*
* Must commit rcu_gp_ctr update to memory before waiting for quiescent
* executed on.
*/
cmm_smp_mb();
- _CAA_STORE_SHARED(rcu_reader.need_mb, 0);
+ _CMM_STORE_SHARED(rcu_reader.need_mb, 0);
cmm_smp_mb();
}
assert(act.sa_sigaction == sigrcu_handler);
assert(cds_list_empty(®istry));
}
+
#endif /* #ifdef RCU_SIGNAL */
+
+#include "urcu-call-rcu-impl.h"
+#include "urcu-defer-impl.h"