Standard library / sync
sync.Locker
Interface for exclusive Lock and Unlock operations. A pointer to Mutex implements it. Expected stdout: 'locked\n'.
Formal Syntax & Structure
go syntaxgo
type Locker interface { Lock() Unlock()}Working Example
Example Snippetgo
package main
import ( "fmt" "sync")
func main() { var m sync.Mutex; var l sync.Locker = &m; l.Lock(); fmt.Println("locked"); l.Unlock() }