MCPcopy
hub / github.com/redis/go-redis / AtomicMax

Struct AtomicMax

internal/util/atomic_max.go:23–30  ·  view source on GitHub ↗

AtomicMax is a thread-safe max container - hasValue indicator true if a value was equal to or greater than threshold - optional threshold for minimum accepted max value - if threshold is not used, initialization-free - — - wait-free CompareAndSwap mechanic

Source from the content-addressed store, hash-verified

21// - —
22// - wait-free CompareAndSwap mechanic
23type AtomicMax struct {
24
25 // value is current max
26 value atomic.Float64
27 // whether [AtomicMax.Value] has been invoked
28 // with value equal or greater to threshold
29 hasValue atomic.Bool
30}
31
32// NewAtomicMax returns a thread-safe max container
33// - if threshold is not used, AtomicMax is initialization-free

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected