return test_hash_cb[test_choice].populate_hash;
}
-unsigned int __thread rand_lookup;
-unsigned long __thread nr_add;
-unsigned long __thread nr_addexist;
-unsigned long __thread nr_del;
-unsigned long __thread nr_delnoent;
-unsigned long __thread lookup_fail;
-unsigned long __thread lookup_ok;
+DEFINE_URCU_TLS(unsigned int, rand_lookup);
+DEFINE_URCU_TLS(unsigned long, nr_add);
+DEFINE_URCU_TLS(unsigned long, nr_addexist);
+DEFINE_URCU_TLS(unsigned long, nr_del);
+DEFINE_URCU_TLS(unsigned long, nr_delnoent);
+DEFINE_URCU_TLS(unsigned long, lookup_fail);
+DEFINE_URCU_TLS(unsigned long, lookup_ok);
struct cds_lfht *test_ht;
pthread_mutex_t affinity_mutex = PTHREAD_MUTEX_INITIALIZER;
-unsigned long long __thread nr_writes;
-unsigned long long __thread nr_reads;
+DEFINE_URCU_TLS(unsigned long long, nr_writes);
+DEFINE_URCU_TLS(unsigned long long, nr_reads);
unsigned int nr_readers;
unsigned int nr_writers;
void *thr_count(void *arg)
{
printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "counter", pthread_self(), (unsigned long)gettid());
+ "counter", (unsigned long) pthread_self(),
+ (unsigned long) gettid());
rcu_register_thread();
printf_verbose("Number of hash chains: %lu.\n",
nr_hash_chains);
printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", pthread_self(), (unsigned long)gettid());
+ "main", (unsigned long) pthread_self(),
+ (unsigned long) gettid());
tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
(opt_auto_resize ? CDS_LFHT_AUTO_RESIZE : 0) |
CDS_LFHT_ACCOUNTING, NULL);
}
+ if (!test_ht) {
+ printf("Error allocating hash table.\n");
+ return -1;
+ }
/*
* Hash Population needs to be seen as a RCU reader