#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/tls-compat.h>
#ifdef __linux__
#include <syscall.h>
return !test_stop;
}
-static unsigned long long __thread nr_writes;
-static unsigned long long __thread nr_reads;
+static DEFINE_URCU_TLS(unsigned long long, nr_writes);
+static DEFINE_URCU_TLS(unsigned long long, nr_reads);
static unsigned int nr_readers;
static unsigned int nr_writers;
if (caa_unlikely(rduration))
loop_sleep(rduration);
pthread_rwlock_unlock(&lock);
- nr_reads++;
+ URCU_TLS(nr_reads)++;
if (caa_unlikely(!test_duration_read()))
break;
}
- *count = nr_reads;
+ *count = URCU_TLS(nr_reads);
printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
"reader", pthread_self(), (unsigned long)gettid());
return ((void*)1);
if (caa_unlikely(wduration))
loop_sleep(wduration);
pthread_rwlock_unlock(&lock);
- nr_writes++;
+ URCU_TLS(nr_writes)++;
if (caa_unlikely(!test_duration_write()))
break;
if (caa_unlikely(wdelay))
printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
"writer", pthread_self(), (unsigned long)gettid());
- *count = nr_writes;
+ *count = URCU_TLS(nr_writes);
return ((void*)2);
}