printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
"reader", pthread_self(), (unsigned long) gettid());
+ URCU_TLS(rand_lookup) = urcu_get_thread_id() ^ time(NULL);
+
set_affinity();
rcu_register_thread();
printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
"writer", pthread_self(), (unsigned long) gettid());
+ URCU_TLS(rand_lookup) = urcu_get_thread_id() ^ time(NULL);
+
set_affinity();
rcu_register_thread();
#include <signal.h>
#include <urcu/tls-compat.h>
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
#define DEFAULT_RAND_POOL 1000000
#define poison_free(ptr) free(ptr)
#endif
-
-
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#else
printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
"reader", pthread_self(), (unsigned long) gettid());
+ URCU_TLS(rand_lookup) = (unsigned int) gettid() ^ time(NULL);
+
set_affinity();
rcu_register_thread();
for (;;) {
rcu_read_lock();
- /* note: only looking up ulong keys */
- key = ((unsigned long) rand_r(&URCU_TLS(rand_lookup)) % lookup_pool_size) + lookup_pool_offset;
+ key = (uint64_t) rand_r(&URCU_TLS(rand_lookup));
+ key += (uint64_t) rand_r(&URCU_TLS(rand_lookup)) << 32ULL;
+ key = (key % lookup_pool_size) + lookup_pool_offset;
key *= key_mul;
+
range = cds_ja_range_lookup(test_ja, key);
if (!range) {
if (validate_lookup) {
printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
"writer", pthread_self(), (unsigned long) gettid());
+ URCU_TLS(rand_lookup) = (unsigned int) gettid() ^ time(NULL);
+
set_affinity();
rcu_register_thread();
struct cds_ja_range *range;
uint64_t start, end, tmp;
- /* note: only inserting ulong keys */
- start = ((unsigned long) rand_r(&URCU_TLS(rand_lookup)) % write_pool_size) + write_pool_offset;
- end = ((unsigned long) rand_r(&URCU_TLS(rand_lookup)) % write_pool_size) + write_pool_offset;
+ start = (uint64_t) rand_r(&URCU_TLS(rand_lookup));
+ start += (uint64_t) rand_r(&URCU_TLS(rand_lookup)) << 32ULL;
+ start = (start % write_pool_size) + write_pool_offset;
+
+ end = (uint64_t) rand_r(&URCU_TLS(rand_lookup));
+ end += (uint64_t) rand_r(&URCU_TLS(rand_lookup)) << 32ULL;
+ end = (end % write_pool_size) + write_pool_offset;
+
start *= key_mul;
end *= key_mul;
if (start > end) {
uint64_t key;
/* May delete */
- /* note: only deleting ulong keys */
- key = ((unsigned long) rand_r(&URCU_TLS(rand_lookup)) % write_pool_size) + write_pool_offset;
+ key = (uint64_t) rand_r(&URCU_TLS(rand_lookup));
+ key += (uint64_t) rand_r(&URCU_TLS(rand_lookup)) << 32ULL;
+ key = (key % write_pool_size) + write_pool_offset;
key *= key_mul;
rcu_read_lock();
#include <signal.h>
#include <urcu/tls-compat.h>
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
#define DEFAULT_RAND_POOL 1000000
#define poison_free(ptr) free(ptr)
#endif
-
-
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#else