Commit 41ed7dd9 authored by Maged Michael's avatar Maged Michael Committed by Facebook Github Bot

hazptr: Fix hazptr_priv::push_all_to_domain to try reclamation when not in dtor

Summary: The most recent change had a bug that prevents all calls to hazptr_priv::push_all_to_domain from trying reclamation, instead of preventing that only when called from the destructor of hazptr_priv and during reclamation.

Reviewed By: davidtgoldblatt

Differential Revision: D8849738

fbshipit-source-id: 15a27e8d4a88288179609e8cf179bc8c10c96b90
parent cf17895f
...@@ -276,7 +276,7 @@ class hazptr_domain { ...@@ -276,7 +276,7 @@ class hazptr_domain {
} }
#if FOLLY_HAZPTR_THR_LOCAL #if FOLLY_HAZPTR_THR_LOCAL
if (!shutdown_) { if (!shutdown_) {
hazptr_priv_tls<Atom>().push_all_to_domain(); hazptr_priv_tls<Atom>().push_all_to_domain(false);
} }
#endif #endif
bool done = ((children.count() == 0) && (retired() == nullptr)); bool done = ((children.count() == 0) && (retired() == nullptr));
......
...@@ -174,7 +174,7 @@ class hazptr_priv { ...@@ -174,7 +174,7 @@ class hazptr_priv {
~hazptr_priv() { ~hazptr_priv() {
in_dtor_ = true; in_dtor_ = true;
if (!empty()) { if (!empty()) {
push_all_to_domain(); push_all_to_domain(false);
} }
} }
...@@ -204,18 +204,18 @@ class hazptr_priv { ...@@ -204,18 +204,18 @@ class hazptr_priv {
} }
} }
if (++rcount_ >= kThreshold) { if (++rcount_ >= kThreshold) {
push_all_to_domain(); push_all_to_domain(true);
} }
} }
void push_all_to_domain() { void push_all_to_domain(bool check_to_reclaim) {
hazptr_obj<Atom>* h = nullptr; hazptr_obj<Atom>* h = nullptr;
hazptr_obj<Atom>* t = nullptr; hazptr_obj<Atom>* t = nullptr;
collect(h, t); collect(h, t);
if (h) { if (h) {
DCHECK(t); DCHECK(t);
hazptr_obj_list<Atom> l(h, t, rcount_); hazptr_obj_list<Atom> l(h, t, rcount_);
hazptr_domain_push_retired<Atom>(l, false); hazptr_domain_push_retired<Atom>(l, check_to_reclaim);
rcount_ = 0; rcount_ = 0;
} }
} }
......
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