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 set_affinity(void)
{
+#if HAVE_SCHED_SETAFFINITY
cpu_set_t mask;
- int cpu;
- int ret;
+ int cpu, ret;
+#endif /* HAVE_SCHED_SETAFFINITY */
if (!use_affinity)
return;
(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