projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cleanup: use an enum for the error states of nr_cpus_mask
[urcu.git]
/
src
/
rculfhash.c
diff --git
a/src/rculfhash.c
b/src/rculfhash.c
index a453326a4124f11ac06aeb14697214d99b3c020d..02c7f0f6dc3564fc4f10348a24ea89deee6a8a3d 100644
(file)
--- a/
src/rculfhash.c
+++ b/
src/rculfhash.c
@@
-347,6
+347,11
@@
struct partition_resize_work {
unsigned long start, unsigned long len);
};
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;
/*
static struct urcu_workqueue *cds_lfht_workqueue;
/*
@@
-624,7
+629,7
@@
static void mutex_unlock(pthread_mutex_t *mutex)
urcu_die(ret);
}
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;
static long split_count_mask = -1;
static int split_count_order = -1;
@@
-634,7
+639,7
@@
static void ht_init_nr_cpus_mask(void)
maxcpus = get_possible_cpus_array_len();
if (maxcpus <= 0) {
maxcpus = get_possible_cpus_array_len();
if (maxcpus <= 0) {
- nr_cpus_mask =
-2
;
+ nr_cpus_mask =
NR_CPUS_MASK_INIT_FAILED
;
return;
}
/*
return;
}
/*
@@
-648,7
+653,7
@@
static void ht_init_nr_cpus_mask(void)
static
void alloc_split_items_count(struct cds_lfht *ht)
{
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;
ht_init_nr_cpus_mask();
if (nr_cpus_mask < 0)
split_count_mask = DEFAULT_SPLIT_COUNT_MASK;
@@
-1241,7
+1246,7
@@
void partition_resize_helper(struct cds_lfht *ht, unsigned long i,
unsigned long thread, nr_threads;
sigset_t newmask, oldmask;
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;
if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD)
goto fallback;
This page took
0.024363 seconds
and
4
git commands to generate.