X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu.c;h=337f7640b44d208855277f6fc53d9322f212d638;hp=38abf7d6a92e045bb2aabbc306a4b7006ed108f8;hb=ad7de003b45b3a7339b90208c321517c2dcbdc3e;hpb=09a9f9867bf0c7fd793f46f1e639ad2042175721 diff --git a/urcu.c b/urcu.c index 38abf7d..337f764 100644 --- a/urcu.c +++ b/urcu.c @@ -6,6 +6,8 @@ * Copyright February 2009 - Mathieu Desnoyers * * Distributed under GPLv2 + * + * IBM's contributions to this file may be relicensed under LGPLv2 or later. */ #include @@ -15,6 +17,7 @@ #include #include #include +#include #include "urcu.h" @@ -99,17 +102,19 @@ static void switch_next_urcu_qparity(void) } #ifdef DEBUG_FULL_MB +#ifdef HAS_INCOHERENT_CACHES static void force_mb_single_thread(struct reader_registry *index) { smp_mb(); } +#endif /* #ifdef HAS_INCOHERENT_CACHES */ static void force_mb_all_threads(void) { smp_mb(); } -#else - +#else /* #ifdef DEBUG_FULL_MB */ +#ifdef HAS_INCOHERENT_CACHES static void force_mb_single_thread(struct reader_registry *index) { assert(registry); @@ -132,6 +137,7 @@ static void force_mb_single_thread(struct reader_registry *index) } smp_mb(); /* read ->need_mb before ending the barrier */ } +#endif /* #ifdef HAS_INCOHERENT_CACHES */ static void force_mb_all_threads(void) { @@ -174,7 +180,7 @@ static void force_mb_all_threads(void) } smp_mb(); /* read ->need_mb before ending the barrier */ } -#endif +#endif /* #else #ifdef DEBUG_FULL_MB */ void wait_for_quiescent_state(void) { @@ -186,6 +192,10 @@ void wait_for_quiescent_state(void) * Wait for each thread urcu_active_readers count to become 0. */ for (index = registry; index < registry + num_readers; index++) { +#ifndef HAS_INCOHERENT_CACHES + while (rcu_old_gp_ongoing(index->urcu_active_readers)) + cpu_relax(); +#else /* #ifndef HAS_INCOHERENT_CACHES */ int wait_loops = 0; /* * BUSY-LOOP. Force the reader thread to commit its @@ -199,6 +209,7 @@ void wait_for_quiescent_state(void) cpu_relax(); } } +#endif /* #else #ifndef HAS_INCOHERENT_CACHES */ } } @@ -360,4 +371,4 @@ void __attribute__((destructor)) urcu_exit(void) assert(act.sa_sigaction == sigurcu_handler); free(registry); } -#endif +#endif /* #ifndef DEBUG_FULL_MB */