Documentation
¶
Overview ¶
Package singleflight provides a duplicate function call suppression mechanism.
Index ¶
- func AddFloat32(addr *float32, delta float32) (new float32)
- func AddFloat64(addr *float64, delta float64) (new float64)
- func CasItem(p *unsafe.Pointer, old, new *DirectItem) bool
- func CasNode[T any](p *unsafe.Pointer, old, new *Node[T]) bool
- func SubUint32(addr *uint32, delta uint32) (new uint32)
- func SubUint64(addr *uint64, delta uint64) (new uint64)
- func WaitGroupState(wg *sync.WaitGroup) (counter int32, wcounter uint32)
- func WaitGroupStopWait(wg *sync.WaitGroup)
- type DirectItem
- type Group
- type Node
- type Pool
- type Result
- type WaitGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFloat32 ¶
func AddFloat64 ¶
AddFloat64 add delta to given address atomically
func WaitGroupState ¶
WaitGroupState返回 sync.WaitGroup 的状态,
func WaitGroupStopWait ¶
Types ¶
type DirectItem ¶
func LoadItem ¶
func LoadItem(p *unsafe.Pointer) *DirectItem
type Group ¶ added in v1.7.8
type Group struct {
// contains filtered or unexported fields
}
Group represents a class of work and forms a namespace in which units of work can be executed with duplicate suppression.
func (*Group) Do ¶ added in v1.7.8
Do executes and returns the results of the given function, making sure that only one execution is in-flight for a given key at a time. If a duplicate comes in, the duplicate caller waits for the original to complete and receives the same results. The return value shared indicates whether v was given to multiple callers.
type Pool ¶ added in v1.6.8
type Pool[T any] struct { // contains filtered or unexported fields }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.