package
Version:
v0.400.0
Opens a new window with list of versions in this module.
Published: Nov 25, 2024
License: Apache-2.0
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
type Mutex[T any] struct {
}
Mutex is a simple mutex that can be used to protect a value.
The zero value is safe to use if the zero value of T is safe to use.
Example:
var m mutex.Mutex[*string]
s := m.Lock()
defer m.Unlock()
*s = "hello"
func (l *Mutex[T]) Lock() T
Lock the Mutex and return its protected value.
func (l *Mutex[T]) Unlock()
Unlock the Mutex. The value returned by Lock is no longer valid.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.