X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=tests%2Fbenchmark%2Ftest_urcu_lfq.c;h=66cf78ca36aa0e4668e663461cd2c84a7c12f8c6;hp=2217760b0f9ae18f56ac887fb6a06f417b710ca4;hb=HEAD;hpb=ce29b37132cef1c1c758e0862ac701e9bb756d29 diff --git a/tests/benchmark/test_urcu_lfq.c b/tests/benchmark/test_urcu_lfq.c index 2217760..66cf78c 100644 --- a/tests/benchmark/test_urcu_lfq.c +++ b/tests/benchmark/test_urcu_lfq.c @@ -33,8 +33,6 @@ #include #include -static volatile int test_go, test_stop; - static unsigned long rduration; static unsigned long duration; @@ -96,12 +94,12 @@ static void set_affinity(void) */ static int test_duration_dequeue(void) { - return !test_stop; + return test_duration_read(); } static int test_duration_enqueue(void) { - return !test_stop; + return test_duration_write(); } static DEFINE_URCU_TLS(unsigned long long, nr_dequeues); @@ -132,10 +130,7 @@ void *thr_enqueuer(void *_count) rcu_register_thread(); - while (!test_go) - { - } - cmm_smp_mb(); + wait_until_go(); for (;;) { struct test *node = malloc(sizeof(*node)); @@ -188,10 +183,7 @@ void *thr_dequeuer(void *_count) rcu_register_thread(); - while (!test_go) - { - } - cmm_smp_mb(); + wait_until_go(); for (;;) { struct cds_lfq_node_rcu *qnode; @@ -361,7 +353,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); @@ -371,7 +363,7 @@ int main(int argc, char **argv) } } - test_stop = 1; + end_test(); for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) { err = pthread_join(tid_enqueuer[i_thr], &tret);