Commit 49f40690 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Use explicit memory orders in SerialExecutor

Summary: [Folly] Use explicit memory orders in `SerialExecutor`.

Reviewed By: andriigrynenko

Differential Revision: D10370862

fbshipit-source-id: 5cc5903d188b131f851a62690cd182de6ba47eb9
parent db4f831f
...@@ -48,9 +48,10 @@ bool SerialExecutor::keepAliveAcquire() { ...@@ -48,9 +48,10 @@ bool SerialExecutor::keepAliveAcquire() {
} }
void SerialExecutor::keepAliveRelease() { void SerialExecutor::keepAliveRelease() {
auto keepAliveCounter = --keepAliveCounter_; auto keepAliveCounter =
DCHECK(keepAliveCounter >= 0); keepAliveCounter_.fetch_sub(1, std::memory_order_acq_rel);
if (!keepAliveCounter) { DCHECK(keepAliveCounter > 0);
if (keepAliveCounter == 1) {
delete this; delete this;
} }
} }
......
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