Standard library / sync
sync.Mutex.Unlock()
Release a locked mutex. Unlocking an unlocked mutex is a runtime error. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (m *Mutex) Unlock()Working Example
Example Snippetgo
package main
import ( "fmt" "sync")
func main() { var m sync.Mutex m.Lock() m.Unlock() ok := m.TryLock() fmt.Println(ok) if ok { m.Unlock() }}