package
Version:
v1.1.0
Opens a new window with list of versions in this module.
Published: Oct 6, 2024
License: BSD-3-Clause
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
Documentation
¶
Package unlock provides unlocking helpers.
Guard unlocks the lock, invokes f, and locks the lock again.
package main
import (
"sync"
"time"
"import.name/lock/unlock"
)
func main() {
var mu sync.Mutex
mu.Lock()
defer mu.Unlock()
unlock.Guard(&mu, func() {
time.Sleep(time.Microsecond)
})
}
Output:
Guarded unlocks the lock, invokes f, and locks the lock again. The
return value is passed through.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.