#include <urcu/cds.h>
-static volatile int test_go, test_stop;
-
static unsigned long rduration;
static unsigned long duration;
*/
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);
rcu_register_thread();
- while (!test_go)
- {
- }
- cmm_smp_mb();
+ wait_until_go();
for (;;) {
struct test *node = malloc(sizeof(*node));
rcu_register_thread();
- while (!test_go)
- {
- }
- cmm_smp_mb();
+ wait_until_go();
for (;;) {
struct cds_lfs_node_rcu *snode;
cmm_smp_mb();
- test_go = 1;
+ begin_test();
for (i_thr = 0; i_thr < duration; i_thr++) {
sleep(1);
}
}
- test_stop = 1;
+ end_test();
for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
err = pthread_join(tid_enqueuer[i_thr], &tret);