X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu-qsbr.c;h=25074d09063a60ae5c94a17b18cd9d241b1e2fb9;hp=84789f2ebfdd4fa89def6fb56274595739a51d02;hb=7a5a38f52b8814d0188b74a91cb635bc205df96c;hpb=f6bdb00daa1ce299dd8ddfba582fa8ecaa2e4e4e diff --git a/urcu-qsbr.c b/urcu-qsbr.c index 84789f2..25074d0 100644 --- a/urcu-qsbr.c +++ b/urcu-qsbr.c @@ -120,6 +120,13 @@ static void update_counter_and_wait(void) STORE_SHARED(rcu_gp_ctr, rcu_gp_ctr + RCU_GP_CTR); #endif /* !(BITS_PER_LONG < 64) */ + /* + * Enforce compiler-order of store to rcu_gp_ctr before before + * load rcu_reader ctr. + * This ensures synchronize_rcu() cannot be starved by readers. + */ + barrier(); + /* * Wait for each thread rcu_reader_qs_gp count to become 0. */