X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=tests%2Ftest_qsbr.c;h=12346c3cea2d0701cf6c3ab45afc30ba61fb7f32;hb=65fcc7e9957a1658327acd121c3d8c3b36f4a94e;hp=fd6e1bc7294f383b576df7053197ce0556f02b43;hpb=2b514ae230510d5f7263f4aa55d633221340903f;p=urcu.git diff --git a/tests/test_qsbr.c b/tests/test_qsbr.c index fd6e1bc..12346c3 100644 --- a/tests/test_qsbr.c +++ b/tests/test_qsbr.c @@ -3,7 +3,7 @@ * * Userspace RCU library - test program * - * Copyright February 2009 - Mathieu Desnoyers + * Copyright February 2009 - Mathieu Desnoyers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,12 +31,15 @@ #include #include #include -#include #include #include #include +#ifdef __linux__ +#include +#endif + /* hardcoded number of CPUs */ #define NR_CPUS 16384 @@ -83,7 +86,7 @@ static unsigned long wduration; static inline void loop_sleep(unsigned long l) { while(l-- != 0) - cpu_relax(); + caa_cpu_relax(); } static int verbose_mode; @@ -230,7 +233,7 @@ void *thr_reader(void *_count) while (!test_go) { } - smp_mb(); + cmm_smp_mb(); for (;;) { rcu_read_lock(); @@ -275,7 +278,7 @@ void *thr_writer(void *_count) while (!test_go) { } - smp_mb(); + cmm_smp_mb(); for (;;) { new = test_array_alloc(); @@ -403,7 +406,7 @@ int main(int argc, char **argv) printf_verbose("thread %-6s, thread id : %lx, tid %lu\n", "main", pthread_self(), (unsigned long)gettid()); - test_array = malloc(sizeof(*test_array) * ARRAY_SIZE); + test_array = calloc(1, sizeof(*test_array) * ARRAY_SIZE); tid_reader = malloc(sizeof(*tid_reader) * nr_readers); tid_writer = malloc(sizeof(*tid_writer) * nr_writers); count_reader = malloc(sizeof(*count_reader) * nr_readers); @@ -424,7 +427,7 @@ int main(int argc, char **argv) exit(1); } - smp_mb(); + cmm_smp_mb(); test_go = 1;