X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu.c;h=bb6629c718086a9800a22a4d3ab21685b27c26a5;hp=a3ceca3f5263be7812288f4e909eed6878246980;hb=935b11ff4cf9053954d21b9d63c4ee367b12a652;hpb=0d342f2fb06c0b2e37a34b0968d1dc26e2220825 diff --git a/urcu.c b/urcu.c index a3ceca3..bb6629c 100644 --- a/urcu.c +++ b/urcu.c @@ -215,6 +215,10 @@ void update_counter_and_wait(void) */ /* + * Enforce compiler-order of store to rcu_gp_ctr before before + * load rcu_reader ctr. + * This ensures synchronize_rcu() cannot be starved by readers. + * * Adding a smp_mb() which is _not_ formally required, but makes the * model easier to understand. It does not have a big performance impact * anyway, given this is the write-side. @@ -233,7 +237,7 @@ void update_counter_and_wait(void) } list_for_each_entry_safe(index, tmp, ®istry, head) { - if (!rcu_old_gp_ongoing(&index->ctr)) + if (!rcu_gp_ongoing(&index->ctr)) list_move(&index->head, &qsreaders); } @@ -346,7 +350,7 @@ void rcu_register_thread(void) { rcu_reader.tid = pthread_self(); assert(rcu_reader.need_mb == 0); - assert(rcu_reader.ctr == 0); + assert(!(rcu_reader.ctr & RCU_GP_CTR_NEST_MASK)); mutex_lock(&rcu_gp_lock); rcu_init(); /* In case gcc does not support constructor attribute */