X-Git-Url: https://git.lttng.org/?p=urcu.git;a=blobdiff_plain;f=tests%2Ftest_mutex.c;h=3f84bbfa06fa6c280a0896e4072bdf9ce41b4a6f;hp=747bcc442dec2a63a507b0bf0be075fe5ee024b7;hb=a0b7f7ea3fc3339a1c42caffd53ce9f056e5b901;hpb=06f22bdbb0c4c4d5db42a2e2dc35818aa61415be diff --git a/tests/test_mutex.c b/tests/test_mutex.c index 747bcc4..3f84bbf 100644 --- a/tests/test_mutex.c +++ b/tests/test_mutex.c @@ -31,12 +31,15 @@ #include #include #include -#include #include #include #include +#ifdef __linux__ +#include +#endif + /* hardcoded number of CPUs */ #define NR_CPUS 16384 @@ -202,11 +205,11 @@ void *thr_reader(void *data) for (;;) { pthread_mutex_lock(&lock); assert(test_array.a == 8); - if (unlikely(rduration)) + if (caa_unlikely(rduration)) loop_sleep(rduration); pthread_mutex_unlock(&lock); nr_reads++; - if (unlikely(!test_duration_read())) + if (caa_unlikely(!test_duration_read())) break; } @@ -235,13 +238,13 @@ void *thr_writer(void *data) pthread_mutex_lock(&lock); test_array.a = 0; test_array.a = 8; - if (unlikely(wduration)) + if (caa_unlikely(wduration)) loop_sleep(wduration); pthread_mutex_unlock(&lock); nr_writes++; - if (unlikely(!test_duration_write())) + if (caa_unlikely(!test_duration_write())) break; - if (unlikely(wdelay)) + if (caa_unlikely(wdelay)) loop_sleep(wdelay); }