+ for (index = registry; index < registry + num_readers; index++) {
+ while (*index->need_mb) {
+ pthread_kill(index->tid, SIGURCU);
+ poll(NULL, 0, 1);
+ }
+ }
+ smp_mb(); /* read ->need_mb before ending the barrier */
+}
+#endif /* #else #ifdef URCU_MB */
+
+/*
+ * synchronize_rcu() waiting. Single thread.
+ */
+static void wait_gp(struct reader_registry *index)
+{
+ uatomic_dec(&gp_futex);
+ force_mb_single_thread(index); /* Write futex before read reader_gp */
+ if (!rcu_old_gp_ongoing(index->urcu_active_readers)) {
+ /* Read reader_gp before write futex */
+ force_mb_single_thread(index);
+ /* Callbacks are queued, don't wait. */
+ uatomic_set(&gp_futex, 0);
+ } else {
+ /* Read reader_gp before read futex */
+ force_mb_single_thread(index);
+ if (uatomic_read(&gp_futex) == -1)
+ futex(&gp_futex, FUTEX_WAIT, -1,
+ NULL, NULL, 0);
+ }