+struct urcu_reader {
+ /* Data used by both reader and synchronize_rcu() */
+ long ctr;
+ char need_mb;
+ /* Data used for registry */
+ struct list_head head __attribute__((aligned(CACHE_LINE_SIZE)));
+ pthread_t tid;
+};
+
+extern struct urcu_reader __thread urcu_reader;
+
+extern int gp_futex;
+
+/*
+ * Wake-up waiting synchronize_rcu(). Called from many concurrent threads.
+ */
+static inline void wake_up_gp(void)
+{
+ if (unlikely(uatomic_read(&gp_futex) == -1)) {
+ uatomic_set(&gp_futex, 0);
+ futex(&gp_futex, FUTEX_WAKE, 1,
+ NULL, NULL, 0);
+ }
+}