Commit b172ccdf authored by Robin Cheng's avatar Robin Cheng Committed by Facebook GitHub Bot

Fix an atomic memory ordering in DefaultKeepAliveExecutor.

Summary: Honestly I haven't spent time to understand why this order needs to be acq_rel, but (1) it's the same as the one used in the other keepAliveRelease in this file (2) this ordering is free for read-modify-write operations (3) TSAN said this works :)

Reviewed By: yfeldblum

Differential Revision: D23495784

fbshipit-source-id: 8bdcafb14b27e6c0f8838ed478364821cd39f9a9
parent c26af9db
...@@ -140,7 +140,7 @@ class DefaultKeepAliveExecutor : public virtual Executor { ...@@ -140,7 +140,7 @@ class DefaultKeepAliveExecutor : public virtual Executor {
void keepAliveRelease() noexcept override { void keepAliveRelease() noexcept override {
auto keepAliveCount = auto keepAliveCount =
controlBlock_->keepAliveCount_.fetch_sub(1, std::memory_order_acquire); controlBlock_->keepAliveCount_.fetch_sub(1, std::memory_order_acq_rel);
DCHECK(keepAliveCount >= 1); DCHECK(keepAliveCount >= 1);
if (keepAliveCount == 1) { if (keepAliveCount == 1) {
......
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