Standard library / sync
sync.RWMutex.RLock()
Acquire shared read access. Pending writers can block new readers, so do not recursively read-lock. Expected stdout: 'reader\n'.
Formal Syntax & Structure
go syntaxgo
func (rw *RWMutex) RLock()Working Example
Example Snippetgo
package main
import ( "fmt" "sync")
func main() { var m sync.RWMutex; m.RLock(); fmt.Println("reader"); m.RUnlock() }