Documentation
¶
Overview ¶
Package sync implements synchronization primitives similar to those provided by the standard Go implementation. These are not safe to access from within interrupts, or from another thread. The primitives also lack any fairness guarantees, similar to channels and the scheduler.
Index ¶
- func OnceFunc(f func()) func()
- func OnceValue[T any](f func() T) func() T
- func OnceValues[T1, T2 any](f func() (T1, T2)) func() (T1, T2)
- type Cond
- type Locker
- type Map
- func (m *Map) Delete(key interface{})
- func (m *Map) Load(key interface{}) (value interface{}, ok bool)
- func (m *Map) LoadAndDelete(key interface{}) (value interface{}, loaded bool)
- func (m *Map) LoadOrStore(key, value interface{}) (actual interface{}, loaded bool)
- func (m *Map) Range(f func(key, value interface{}) bool)
- func (m *Map) Store(key, value interface{})
- type Mutex
- type Once
- type Pool
- type RWMutex
- type WaitGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OnceFunc ¶ added in v0.29.0
func OnceFunc(f func()) func()
OnceFunc returns a function that invokes f only once. The returned function may be called concurrently.
If f panics, the returned function will panic with the same value on every call.
func OnceValue ¶ added in v0.29.0
func OnceValue[T any](f func() T) func() T
OnceValue returns a function that invokes f only once and returns the value returned by f. The returned function may be called concurrently.
If f panics, the returned function will panic with the same value on every call.
func OnceValues ¶ added in v0.29.0
func OnceValues[T1, T2 any](f func() (T1, T2)) func() (T1, T2)
OnceValues returns a function that invokes f only once and returns the values returned by f. The returned function may be called concurrently.
If f panics, the returned function will panic with the same value on every call.
Types ¶
type Cond ¶ added in v0.14.0
type Cond struct { L Locker // contains filtered or unexported fields }
type Map ¶ added in v0.13.0
type Map struct {
// contains filtered or unexported fields
}
func (*Map) LoadAndDelete ¶ added in v0.26.0
func (*Map) LoadOrStore ¶ added in v0.13.0
type Mutex ¶
type Mutex struct {
// contains filtered or unexported fields
}
type Pool ¶
type Pool struct { New func() interface{} // contains filtered or unexported fields }
Pool is a very simple implementation of sync.Pool.
type RWMutex ¶
type RWMutex struct {
// contains filtered or unexported fields
}