Standard library / sync

sync.RWMutex.Lock()

Acquire exclusive write access; blocks until current holders release. Expected stdout: 'writer\n'.

Formal Syntax & Structure

go syntaxgo
func (rw *RWMutex) Lock()

Working Example

Example Snippetgo
package main
import (  "fmt"  "sync")
func main() { var m sync.RWMutex; m.Lock(); fmt.Println("writer"); m.Unlock() }
Go Reference