Commit 9e652978 authored by Maged Michael's avatar Maged Michael Committed by Facebook Github Bot

ConcurrentHashMap: Enable destruction order guarantee

Summary: Enable destruction order guarantee, i.e., destructors for all key and value instances will complete before the completion of the destructor of the associated ConcurrentHashMap instance.

Reviewed By: davidtgoldblatt

Differential Revision: D13440153

fbshipit-source-id: 21dce09fa5ece00eaa9caf7a37b5a64be3319d5e
parent b693ea20
......@@ -169,12 +169,7 @@ class NodeT : public hazptr_obj_base_linked<
DCHECK(batch);
this->set_deleter( // defined in hazptr_obj
concurrenthashmap::HazptrDeleter<Allocator>());
/* Note: Temporarily commenting out the next line to disable the
* use of hazptr_obj_batch until higher-level users adapt to the
* destruction order guarantee of completing the destruction of
* keys and values by the completion of the destructor of the
* associated ConcurrentHashMap. */
// this->set_batch_tag(batch); // defined in hazptr_obj
this->set_batch_tag(batch); // defined in hazptr_obj
this->acquire_link_safe(); // defined in hazptr_obj_base_linked
}
......@@ -674,7 +669,7 @@ class alignas(64) ConcurrentHashMapSegment {
Allocator().allocate(sizeof(Buckets) + sizeof(BucketRoot) * count);
auto buckets = new (buf) Buckets();
DCHECK(batch);
// buckets->set_batch_tag(batch); // defined in hazptr_obj
buckets->set_batch_tag(batch); // defined in hazptr_obj
for (size_t i = 0; i < count; i++) {
new (&buckets->buckets_[i]) BucketRoot;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment