X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=rculfhash.c;h=070bcaf7c52acf5687ef3f729a62f5e41572d4e1;hb=24953e081b6cb2e0f4ce1de1c42664ece3c3ce1b;hp=638432a90b3121ef3c4b1a9d870680e1f6ba98f9;hpb=91452a6aeb429d72aafaed0fd176cac5e742251d;p=urcu.git diff --git a/rculfhash.c b/rculfhash.c index 638432a..070bcaf 100644 --- 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; - node = iter->node; - next = iter->next; - node = clear_flag(next); - + node = clear_flag(iter->next); 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]; - iter->node = (struct cds_lfht_node *) lookup; + iter->next = lookup->next; 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 */ - 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); @@ -1653,6 +1651,8 @@ void _do_cds_lfht_resize(struct cds_lfht *ht) * Resize table, re-do if the target size has changed under us. */ do { + if (CMM_LOAD_SHARED(ht->in_progress_destroy)) + break; ht->t.resize_initiated = 1; old_size = ht->t.size; new_size = CMM_LOAD_SHARED(ht->t.resize_target);