Fix: update ax_pthread macro to handle newer clang
[urcu.git] / rculfhash.c
index 19767096d20b0f3e840059596a7ea0ec4673c30f..d7d107f3788f3a70cec57be5380ae1ff1bbff173 100644 (file)
 #include <stdint.h>
 #include <string.h>
 #include <sched.h>
+#include <unistd.h>
 
 #include "config.h"
-#include <urcu.h>
+#include "compat-getcpu.h"
+#include <urcu-pointer.h>
 #include <urcu-call-rcu.h>
 #include <urcu-flavor.h>
 #include <urcu/arch.h>
@@ -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;
This page took 0.022926 seconds and 4 git commands to generate.