File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -468,13 +468,18 @@ bool dictRehashSomeAsync(dictAsyncRehashCtl *ctl, size_t hashes) {
468468
469469
470470void discontinueAsyncRehash (dict *d) {
471+ // We inform our async rehashers and the completion function the results are to be
472+ // abandoned. We keep the asyncdata linked in so that dictEntry's are still added
473+ // to the GC list. This is because we can't gurantee when the other threads will
474+ // stop looking at them.
471475 if (d->asyncdata != nullptr ) {
472476 auto adata = d->asyncdata ;
473- while (adata != nullptr ) {
477+ while (adata != nullptr && !adata-> abondon . load (std::memory_order_relaxed) ) {
474478 adata->abondon = true ;
475479 adata = adata->next ;
476480 }
477- d->rehashidx = 0 ;
481+ if (dictIsRehashing (d))
482+ d->rehashidx = 0 ;
478483 }
479484}
480485
You can’t perform that action at this time.
0 commit comments