X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=rculfhash.c;h=93514d429a5d4fe242fec8b102288101e9a1d78f;hb=59290e9dc90ce01920f1a18a8699dd6872c45ffc;hp=03209623de816e6ad2a6668989706f9b362860ce;hpb=853395e1ef65b85c08ddf7b92034f0d51cd5bf46;p=urcu.git diff --git a/rculfhash.c b/rculfhash.c index 0320962..93514d4 100644 --- a/rculfhash.c +++ b/rculfhash.c @@ -1542,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); @@ -1718,7 +1719,9 @@ 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(); /* increment resize count before calling it */ + cmm_smp_mb(); /* increment resize count before load destroy */ + if (CMM_LOAD_SHARED(ht->in_progress_destroy)) + return; work = malloc(sizeof(*work)); work->ht = ht; ht->cds_lfht_call_rcu(&work->head, do_resize_cb); @@ -1741,7 +1744,9 @@ 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(); /* increment resize count before calling it */ + cmm_smp_mb(); /* increment resize count before load destroy */ + if (CMM_LOAD_SHARED(ht->in_progress_destroy)) + return; work = malloc(sizeof(*work)); work->ht = ht; ht->cds_lfht_call_rcu(&work->head, do_resize_cb);