X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=rculfhash.c;h=d7d107f3788f3a70cec57be5380ae1ff1bbff173;hp=19767096d20b0f3e840059596a7ea0ec4673c30f;hb=7be759d1adf95b168f09e513232ea26de15e1eaf;hpb=67ecffc0f530a7b5c4dd5111ea7dd3213da8eb91 diff --git a/rculfhash.c b/rculfhash.c index 1976709..d7d107f 100644 --- a/rculfhash.c +++ b/rculfhash.c @@ -264,9 +264,11 @@ #include #include #include +#include #include "config.h" -#include +#include "compat-getcpu.h" +#include #include #include #include @@ -619,26 +621,18 @@ void free_split_items_count(struct cds_lfht *ht) poison_free(ht->split_count); } -#if defined(HAVE_SCHED_GETCPU) static int ht_get_split_count_index(unsigned long hash) { int cpu; assert(split_count_mask >= 0); - cpu = sched_getcpu(); + cpu = urcu_sched_getcpu(); if (caa_unlikely(cpu < 0)) return hash & split_count_mask; else return cpu & split_count_mask; } -#else /* #if defined(HAVE_SCHED_GETCPU) */ -static -int ht_get_split_count_index(unsigned long hash) -{ - return hash & split_count_mask; -} -#endif /* #else #if defined(HAVE_SCHED_GETCPU) */ static void ht_count_add(struct cds_lfht *ht, unsigned long size, unsigned long hash) @@ -1805,6 +1799,9 @@ int cds_lfht_destroy(struct cds_lfht *ht, pthread_attr_t **attr) free_split_items_count(ht); if (attr) *attr = ht->resize_attr; + ret = pthread_mutex_destroy(&ht->resize_mutex); + if (ret) + ret = -EBUSY; poison_free(ht); end: return ret;