X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=tests%2Fbenchmark%2Ftest_urcu_wfcq.c;fp=tests%2Fbenchmark%2Ftest_urcu_wfcq.c;h=71bca100cd45670e15ff452eabfab389b0023d1a;hp=7f18af0615c79a0f5814e9f58bf99d463a52991b;hb=9e4e7ad18c86159520b330fab94b93f7ab6d221c;hpb=c8c32a5208d6e624f9ae9466196e355269c611d5 diff --git a/tests/benchmark/test_urcu_wfcq.c b/tests/benchmark/test_urcu_wfcq.c index 7f18af0..71bca10 100644 --- a/tests/benchmark/test_urcu_wfcq.c +++ b/tests/benchmark/test_urcu_wfcq.c @@ -42,7 +42,7 @@ static enum test_sync test_sync; static int test_force_sync; -static volatile int test_go, test_stop_enqueue, test_stop_dequeue; +static volatile int test_stop_enqueue, test_stop_dequeue; static unsigned long rduration; @@ -108,12 +108,12 @@ static void set_affinity(void) */ static int test_duration_dequeue(void) { - return !test_stop_dequeue; + return !uatomic_load(&test_stop_dequeue, CMM_RELAXED); } static int test_duration_enqueue(void) { - return !test_stop_enqueue; + return !uatomic_load(&test_stop_enqueue, CMM_RELAXED); } static DEFINE_URCU_TLS(unsigned long long, nr_dequeues); @@ -141,10 +141,7 @@ static void *thr_enqueuer(void *_count) set_affinity(); - while (!test_go) - { - } - cmm_smp_mb(); + wait_until_go(); for (;;) { struct cds_wfcq_node *node = malloc(sizeof(*node)); @@ -252,10 +249,7 @@ static void *thr_dequeuer(void *_count) set_affinity(); - while (!test_go) - { - } - cmm_smp_mb(); + wait_until_go(); for (;;) { if (test_dequeue && test_splice) { @@ -468,7 +462,7 @@ int main(int argc, char **argv) cmm_smp_mb(); - test_go = 1; + begin_test(); for (i_thr = 0; i_thr < duration; i_thr++) { sleep(1); @@ -478,7 +472,7 @@ int main(int argc, char **argv) } } - test_stop_enqueue = 1; + uatomic_store(&test_stop_enqueue, 1, CMM_RELEASE); if (test_wait_empty) { while (nr_enqueuers != uatomic_read(&test_enqueue_stopped)) { @@ -489,7 +483,7 @@ int main(int argc, char **argv) } } - test_stop_dequeue = 1; + uatomic_store(&test_stop_dequeue, 1, CMM_RELAXED); for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) { err = pthread_join(tid_enqueuer[i_thr], &tret);