+static void switch_qparity(void)
+{
+ int prev_parity;
+
+ /* All threads should read qparity before accessing data structure. */
+ /* Write ptr before changing the qparity */
+ force_mb_all_threads();
+ debug_yield_write();
+ prev_parity = switch_next_urcu_qparity();
+ debug_yield_write();
+
+ /*
+ * Wait for previous parity to be empty of readers.
+ */
+ wait_for_quiescent_state(prev_parity);
+}
+
+void synchronize_rcu(void)
+{
+ debug_yield_write();
+ internal_urcu_lock();
+ debug_yield_write();
+ switch_qparity();
+ debug_yield_write();
+ switch_qparity();
+ debug_yield_write();
+ internal_urcu_lock();
+ debug_yield_write();
+}
+