Standard library / sync
sync.RWMutex.TryRLock()
Attempt read acquisition without blocking. Failure provides no synchronization. Expected stdout: 'false\n'.
Formal Syntax & Structure
go syntaxgo
func (rw *RWMutex) TryRLock() boolReturn Value
bool
Whether read access was acquired.
Working Example
Example Snippetgo
package main
import ( "fmt" "sync")
func main() { var m sync.RWMutex; m.Lock(); fmt.Println(m.TryRLock()); m.Unlock() }