summaryrefslogtreecommitdiff
path: root/absl/synchronization/mutex.cc
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2023-06-15 23:40:29 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-06-15 23:41:29 -0700
commitb6a417bbd7eba01b83a03748710d180372be5e67 (patch)
treeb3cfa78ad64cbc1b444753d668ba551abeee028a /absl/synchronization/mutex.cc
parentbf69aa3ca20aa04350fbd04efd8ac7ad4bb22e79 (diff)
absl: move comment in mutex.cc to where it belongs
Move the comment that relates to kMuDesig close to kMuDesig definition. Currently it's placed in between unrelated flags. NFC PiperOrigin-RevId: 540792401 Change-Id: I5f6a928cd9e01664812b2a7c3d9eb087c0723d7f
Diffstat (limited to 'absl/synchronization/mutex.cc')
-rw-r--r--absl/synchronization/mutex.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/absl/synchronization/mutex.cc b/absl/synchronization/mutex.cc
index 16a8fbff..0742680c 100644
--- a/absl/synchronization/mutex.cc
+++ b/absl/synchronization/mutex.cc
@@ -639,18 +639,18 @@ void Mutex::InternalAttemptToUseMutexInFatalSignalHandler() {
// o kMuWriter / kMuReader == kMuWrWait / kMuWait,
// to enable the bit-twiddling trick in CheckForMutexCorruption().
static const intptr_t kMuReader = 0x0001L; // a reader holds the lock
-static const intptr_t kMuDesig = 0x0002L; // there's a designated waker
-static const intptr_t kMuWait = 0x0004L; // threads are waiting
-static const intptr_t kMuWriter = 0x0008L; // a writer holds the lock
-static const intptr_t kMuEvent = 0x0010L; // record this mutex's events
+// There's a designated waker.
// INVARIANT1: there's a thread that was blocked on the mutex, is
// no longer, yet has not yet acquired the mutex. If there's a
// designated waker, all threads can avoid taking the slow path in
// unlock because the designated waker will subsequently acquire
// the lock and wake someone. To maintain INVARIANT1 the bit is
// set when a thread is unblocked(INV1a), and threads that were
-// unblocked reset the bit when they either acquire or re-block
-// (INV1b).
+// unblocked reset the bit when they either acquire or re-block (INV1b).
+static const intptr_t kMuDesig = 0x0002L;
+static const intptr_t kMuWait = 0x0004L; // threads are waiting
+static const intptr_t kMuWriter = 0x0008L; // a writer holds the lock
+static const intptr_t kMuEvent = 0x0010L; // record this mutex's events
static const intptr_t kMuWrWait = 0x0020L; // runnable writer is waiting
// for a reader
static const intptr_t kMuSpin = 0x0040L; // spinlock protects wait list