X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=tests%2Ftest_urcu_hash.c;h=5710de08135f8e0f58be45bfec59cca94636031e;hp=accf3c1ab1ff76a0e37b876da268ba690122e916;hb=bd252a04bbbb163aa4d8864b1e1e5a3a4d9d0892;hpb=495913bfaec0ff19107f0cc903ba1d6eade03709 diff --git a/tests/test_urcu_hash.c b/tests/test_urcu_hash.c index accf3c1..5710de0 100644 --- a/tests/test_urcu_hash.c +++ b/tests/test_urcu_hash.c @@ -82,13 +82,13 @@ int (*get_populate_hash_cb(void))(void) 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; @@ -126,8 +126,8 @@ int use_affinity = 0; 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; @@ -560,6 +560,10 @@ int main(int argc, char **argv) (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