Skip to content

Commit 8bbdf11

Browse files
committed
Explicitly comment that compare_exchange_weak updates its first parameter.
1 parent 1c434a9 commit 8bbdf11

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

common/autoresetevent.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class AutoResetEvent
4040
int newStatus = oldStatus + 1;
4141
if (m_status.compare_exchange_weak(oldStatus, newStatus, std::memory_order_release, std::memory_order_relaxed))
4242
break;
43-
// The compare-exchange failed, likely because another thread changed it between attempts.
44-
// Retry the CAS loop.
43+
// The compare-exchange failed, likely because another thread changed m_status.
44+
// oldStatus now has its latest value (passed by reference). Retry the CAS loop.
4545
}
4646
if (oldStatus < 0)
4747
m_sema.signal(); // Release one waiting thread.

0 commit comments

Comments
 (0)