X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu.c;h=b8567555d09ecbb22547aa6f236392d439eea871;hp=140cd19b98add54f276755e08b13bfad9e8c3d0c;hb=7a5a38f52b8814d0188b74a91cb635bc205df96c;hpb=27d65bc5db18f8563a9120924569acffb845ec4d diff --git a/urcu.c b/urcu.c index 140cd19..b856755 100644 --- a/urcu.c +++ b/urcu.c @@ -99,9 +99,9 @@ static void mutex_lock(pthread_mutex_t *mutex) perror("Error in pthread mutex lock"); exit(-1); } - if (rcu_reader.need_mb) { + if (LOAD_SHARED(rcu_reader.need_mb)) { smp_mb(); - rcu_reader.need_mb = 0; + _STORE_SHARED(rcu_reader.need_mb, 0); smp_mb(); } poll(NULL,0,10); @@ -155,8 +155,7 @@ static void force_mb_all_readers(void) * cache flush is enforced. */ list_for_each_entry(index, ®istry, head) { - index->need_mb = 1; - smp_mc(); /* write need_mb before sending the signal */ + STORE_SHARED(index->need_mb, 1); pthread_kill(index->tid, SIGRCU); } /* @@ -173,7 +172,7 @@ static void force_mb_all_readers(void) * the Linux Test Project (LTP). */ list_for_each_entry(index, ®istry, head) { - while (index->need_mb) { + while (LOAD_SHARED(index->need_mb)) { pthread_kill(index->tid, SIGRCU); poll(NULL, 0, 1); } @@ -234,7 +233,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); } @@ -347,7 +346,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 */ @@ -382,7 +381,7 @@ static void sigrcu_handler(int signo, siginfo_t *siginfo, void *context) * executed on. */ smp_mb(); - rcu_reader.need_mb = 0; + _STORE_SHARED(rcu_reader.need_mb, 0); smp_mb(); }