package
module
Version:
v0.0.0-...-f249337
Opens a new window with list of versions in this module.
Published: Dec 5, 2021
License: BSD-3-Clause
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 8
Opens a new window with list of known importers.
README
¶
Example
import "import.name/lock"
import "import.name/lock/unlock"
func ExampleLock() {
var (
mu sync.Mutex
count int
)
lock.Guard(&mu, func() {
count++
})
// Go 1.18:
n := lock.Guarded(&mu, func() int {
return count
})
fmt.Println(n)
}
func ExampleUnlock() {
var mu sync.Mutex
mu.Lock()
defer mu.Unlock()
unlock.Guard(&mu, func() {
time.Sleep(time.Second)
})
}
Documentation
¶
Package lock provides locking helpers.
Guard invokes f while keeping the lock locked.
Source Files
¶
Directories
¶
Package unlock provides unlocking helpers.
|
Package unlock provides unlocking helpers. |
Click to show internal directories.
Click to hide internal directories.