projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rculfhash: decrement resize cnt on destroy
[urcu.git]
/
rculfhash.c
diff --git
a/rculfhash.c
b/rculfhash.c
index 638432a90b3121ef3c4b1a9d870680e1f6ba98f9..8a9e0974926d7ce3973f40b92fb629eebc58e0f2 100644
(file)
--- a/
rculfhash.c
+++ b/
rculfhash.c
@@
-1399,10
+1399,7
@@
void cds_lfht_next(struct cds_lfht *ht, struct cds_lfht_iter *iter)
{
struct cds_lfht_node *node, *next;
{
struct cds_lfht_node *node, *next;
- node = iter->node;
- next = iter->next;
- node = clear_flag(next);
-
+ node = clear_flag(iter->next);
for (;;) {
if (unlikely(is_end(node))) {
node = next = NULL;
for (;;) {
if (unlikely(is_end(node))) {
node = next = NULL;
@@
-1429,7
+1426,7
@@
void cds_lfht_first(struct cds_lfht *ht, struct cds_lfht_iter *iter)
* first node of the linked list.
*/
lookup = &ht->t.tbl[0]->nodes[0];
* first node of the linked list.
*/
lookup = &ht->t.tbl[0]->nodes[0];
- iter->n
ode = (struct cds_lfht_node *) lookup
;
+ iter->n
ext = lookup->next
;
cds_lfht_next(ht, iter);
}
cds_lfht_next(ht, iter);
}
@@
-1545,7
+1542,8
@@
int cds_lfht_destroy(struct cds_lfht *ht, pthread_attr_t **attr)
int ret;
/* Wait for in-flight resize operations to complete */
int ret;
/* Wait for in-flight resize operations to complete */
- CMM_STORE_SHARED(ht->in_progress_destroy, 1);
+ _CMM_STORE_SHARED(ht->in_progress_destroy, 1);
+ cmm_smp_mb(); /* Store destroy before load resize */
while (uatomic_read(&ht->in_progress_resize))
poll(NULL, 0, 100); /* wait for 100ms */
ret = cds_lfht_delete_dummy(ht);
while (uatomic_read(&ht->in_progress_resize))
poll(NULL, 0, 100); /* wait for 100ms */
ret = cds_lfht_delete_dummy(ht);
@@
-1721,7
+1719,11
@@
void cds_lfht_resize_lazy(struct cds_lfht *ht, unsigned long size, int growth)
cmm_smp_mb();
if (!CMM_LOAD_SHARED(ht->t.resize_initiated) && size < target_size) {
uatomic_inc(&ht->in_progress_resize);
cmm_smp_mb();
if (!CMM_LOAD_SHARED(ht->t.resize_initiated) && size < target_size) {
uatomic_inc(&ht->in_progress_resize);
- cmm_smp_mb(); /* increment resize count before calling it */
+ cmm_smp_mb(); /* increment resize count before load destroy */
+ if (CMM_LOAD_SHARED(ht->in_progress_destroy)) {
+ uatomic_dec(&ht->in_progress_resize);
+ return;
+ }
work = malloc(sizeof(*work));
work->ht = ht;
ht->cds_lfht_call_rcu(&work->head, do_resize_cb);
work = malloc(sizeof(*work));
work->ht = ht;
ht->cds_lfht_call_rcu(&work->head, do_resize_cb);
@@
-1744,7
+1746,11
@@
void cds_lfht_resize_lazy_count(struct cds_lfht *ht, unsigned long size,
cmm_smp_mb();
if (!CMM_LOAD_SHARED(ht->t.resize_initiated)) {
uatomic_inc(&ht->in_progress_resize);
cmm_smp_mb();
if (!CMM_LOAD_SHARED(ht->t.resize_initiated)) {
uatomic_inc(&ht->in_progress_resize);
- cmm_smp_mb(); /* increment resize count before calling it */
+ cmm_smp_mb(); /* increment resize count before load destroy */
+ if (CMM_LOAD_SHARED(ht->in_progress_destroy)) {
+ uatomic_dec(&ht->in_progress_resize);
+ return;
+ }
work = malloc(sizeof(*work));
work->ht = ht;
ht->cds_lfht_call_rcu(&work->head, do_resize_cb);
work = malloc(sizeof(*work));
work->ht = ht;
ht->cds_lfht_call_rcu(&work->head, do_resize_cb);
This page took
0.024409 seconds
and
4
git commands to generate.