mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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 <bradfitz@golang.org> Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
6c2458e72d
commit
09ebbf4085
5 changed files with 293 additions and 0 deletions
|
|
@ -349,3 +349,27 @@ func blockOnSystemStackInternal() {
|
|||
lock(&deadlock)
|
||||
lock(&deadlock)
|
||||
}
|
||||
|
||||
type RWMutex struct {
|
||||
rw rwmutex
|
||||
}
|
||||
|
||||
func (rw *RWMutex) Init() {
|
||||
rw.rw.init()
|
||||
}
|
||||
|
||||
func (rw *RWMutex) RLock() {
|
||||
rw.rw.rlock()
|
||||
}
|
||||
|
||||
func (rw *RWMutex) RUnlock() {
|
||||
rw.rw.runlock()
|
||||
}
|
||||
|
||||
func (rw *RWMutex) Lock() {
|
||||
rw.rw.lock()
|
||||
}
|
||||
|
||||
func (rw *RWMutex) Unlock() {
|
||||
rw.rw.unlock()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue