Skip to content

Commit f7b4b47

Browse files
committed
address TSAN issue in async_scope described by #1731
1 parent 250f357 commit f7b4b47

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/exec/async_scope.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ namespace exec {
159159

160160
static void __complete(const __impl* __scope) noexcept {
161161
auto& __active = __scope->__active_;
162+
std::unique_lock __guard{__scope->__lock_};
162163
if (__active.fetch_sub(1, __std::memory_order_acq_rel) == 1) {
163-
std::unique_lock __guard{__scope->__lock_};
164164
auto __local_waiters = std::move(__scope->__waiters_);
165165
__guard.unlock();
166166
__scope = nullptr;

0 commit comments

Comments
 (0)