aboutsummaryrefslogtreecommitdiff
path: root/src/sync/rwmutex.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/sync/rwmutex.go')
-rw-r--r--src/sync/rwmutex.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/sync/rwmutex.go b/src/sync/rwmutex.go
index 7b10808ec4..e914f3eba0 100644
--- a/src/sync/rwmutex.go
+++ b/src/sync/rwmutex.go
@@ -25,6 +25,14 @@ import (
// recursive read locking. This is to ensure that the lock eventually becomes
// available; a blocked Lock call excludes new readers from acquiring the
// lock.
+//
+// In the terminology of the Go memory model,
+// the n'th call to Unlock “synchronizes before” the m'th call to Lock
+// for any n < m, just as for Mutex.
+// For any call to RLock, there exists an n such that
+// the n'th call to Unlock “synchronizes before” that call to RLock,
+// and the corresponding call to RUnlock “synchronizes before”
+// the n+1'th call to Lock.
type RWMutex struct {
w Mutex // held if there are pending writers
writerSem uint32 // semaphore for writers to wait for completing readers