X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu.c;h=a3ceca3f5263be7812288f4e909eed6878246980;hp=140cd19b98add54f276755e08b13bfad9e8c3d0c;hb=0d342f2fb06c0b2e37a34b0968d1dc26e2220825;hpb=27d65bc5db18f8563a9120924569acffb845ec4d diff --git a/urcu.c b/urcu.c index 140cd19..a3ceca3 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); } @@ -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(); }