From 09ebbf408530b82f1a817e2f648e1c5618eeb1ab Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 15 Jun 2017 16:42:08 -0700 Subject: runtime: add read/write mutex type This is a runtime version of sync.RWMutex that can be used by code in the runtime package. The type is not quite the same, in that the zero value is not valid. For future use by CL 43713. Updates #19546 Change-Id: I431eb3688add16ce1274dab97285f555b72735bf Reviewed-on: https://go-review.googlesource.com/45991 Reviewed-by: Brad Fitzpatrick Reviewed-by: Austin Clements --- src/sync/rwmutex.go | 3 +++ src/sync/rwmutex_test.go | 3 +++ 2 files changed, 6 insertions(+) (limited to 'src/sync') diff --git a/src/sync/rwmutex.go b/src/sync/rwmutex.go index 94889149a1..cb2dfe1ad8 100644 --- a/src/sync/rwmutex.go +++ b/src/sync/rwmutex.go @@ -10,6 +10,9 @@ import ( "unsafe" ) +// There is a modified copy of this file in runtime/rwmutex.go. +// If you make any changes here, see if you should make them there. + // An RWMutex is a reader/writer mutual exclusion lock. // The lock can be held by an arbitrary number of readers or a single writer. // The zero value for a RWMutex is an unlocked mutex. diff --git a/src/sync/rwmutex_test.go b/src/sync/rwmutex_test.go index 0436f97239..9ee8864ceb 100644 --- a/src/sync/rwmutex_test.go +++ b/src/sync/rwmutex_test.go @@ -14,6 +14,9 @@ import ( "testing" ) +// There is a modified copy of this file in runtime/rwmutex_test.go. +// If you make any changes here, see if you should make them there. + func parallelReader(m *RWMutex, clocked, cunlock, cdone chan bool) { m.RLock() clocked <- true -- cgit v1.3-5-g9baa