#include <urcu/uatomic.h>
#include <urcu/compiler.h>
#include <urcu/rculfhash.h>
-#include <urcu/static/urcu-signal-nr.h>
#include <stdio.h>
#include <pthread.h>
#include <signal.h>
unsigned long start, unsigned long len);
};
+enum nr_cpus_mask_state {
+ NR_CPUS_MASK_INIT_FAILED = -2,
+ NR_CPUS_MASK_UNINITIALIZED = -1,
+};
+
static struct urcu_workqueue *cds_lfht_workqueue;
/*
urcu_die(ret);
}
-static long nr_cpus_mask = -1;
+static long nr_cpus_mask = NR_CPUS_MASK_UNINITIALIZED;
static long split_count_mask = -1;
static int split_count_order = -1;
maxcpus = get_possible_cpus_array_len();
if (maxcpus <= 0) {
- nr_cpus_mask = -2;
+ nr_cpus_mask = NR_CPUS_MASK_INIT_FAILED;
return;
}
/*
static
void alloc_split_items_count(struct cds_lfht *ht)
{
- if (nr_cpus_mask == -1) {
+ if (nr_cpus_mask == NR_CPUS_MASK_UNINITIALIZED) {
ht_init_nr_cpus_mask();
if (nr_cpus_mask < 0)
split_count_mask = DEFAULT_SPLIT_COUNT_MASK;
struct cds_lfht_node *node)
{
struct cds_lfht_node *bucket, *next;
- struct cds_lfht_node **node_next;
+ uintptr_t *node_next;
if (!node) /* Return -ENOENT if asked to delete NULL node */
return -ENOENT;
* NOTE: The node_next variable is present to avoid breaking
* strict-aliasing rules.
*/
- node_next = &node->next;
+ node_next = (uintptr_t*)&node->next;
uatomic_or_mo(node_next, REMOVED_FLAG, CMM_RELEASE);
/* We performed the (logical) deletion. */
unsigned long thread, nr_threads;
sigset_t newmask, oldmask;
- urcu_posix_assert(nr_cpus_mask != -1);
+ urcu_posix_assert(nr_cpus_mask != NR_CPUS_MASK_UNINITIALIZED);
if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD)
goto fallback;
for (j = size + start; j < size + start + len; j++) {
struct cds_lfht_node *fini_bucket = bucket_at(ht, j);
struct cds_lfht_node *parent_bucket = bucket_at(ht, j - size);
- struct cds_lfht_node **fini_bucket_next;
+ uintptr_t *fini_bucket_next;
urcu_posix_assert(j >= size && j < (size << 1));
dbg_printf("remove entry: order %lu index %lu hash %lu\n",
* NOTE: The fini_bucket_next variable is present to
* avoid breaking strict-aliasing rules.
*/
- fini_bucket_next = &fini_bucket->next;
+ fini_bucket_next = (uintptr_t*)&fini_bucket->next;
uatomic_or(fini_bucket_next, REMOVED_FLAG);
_cds_lfht_gc_bucket(parent_bucket, fini_bucket);
}