Import path:
gitlab.soludian.com/soludian/fountain/libs/fsync/fatomic
fatomic
import "gitlab.soludian.com/soludian/fountain/libs/fsync/fatomic"Index
- type AtomicBool
- type AtomicDuration
- func NewAtomicDuration(duration time.Duration) AtomicDuration
- func (d *AtomicDuration) Add(duration time.Duration) time.Duration
- func (d *AtomicDuration) CompareAndSwap(oldval, newval time.Duration) (swapped bool)
- func (d *AtomicDuration) Get() time.Duration
- func (d *AtomicDuration) Set(duration time.Duration)
- type AtomicInt32
- type AtomicInt64
- type AtomicString
type AtomicBool
AtomicBool gives an atomic boolean variable.
type AtomicBool struct {
// contains filtered or unexported fields
}func NewAtomicBool
func NewAtomicBool(n bool) AtomicBoolNewAtomicBool initializes a new AtomicBool with a given value.
func (*AtomicBool) Get
func (i *AtomicBool) Get() boolGet atomically returns the current value.
func (*AtomicBool) Set
func (i *AtomicBool) Set(n bool)Set atomically sets n as new value.
type AtomicDuration
AtomicDuration is a wrapper with a simpler interface around atomic.(Add|Store|Load|CompareAndSwap)Int64 functions.
type AtomicDuration struct {
// contains filtered or unexported fields
}func NewAtomicDuration
func NewAtomicDuration(duration time.Duration) AtomicDurationNewAtomicDuration initializes a new AtomicDuration with a given value.
func (*AtomicDuration) Add
func (d *AtomicDuration) Add(duration time.Duration) time.DurationAdd atomically adds duration to the value.
func (*AtomicDuration) CompareAndSwap
func (d *AtomicDuration) CompareAndSwap(oldval, newval time.Duration) (swapped bool)CompareAndSwap atomatically swaps the old with the new value.
func (*AtomicDuration) Get
func (d *AtomicDuration) Get() time.DurationGet atomically returns the current value.
func (*AtomicDuration) Set
func (d *AtomicDuration) Set(duration time.Duration)Set atomically sets duration as new value.
type AtomicInt32
AtomicInt32 is a wrapper with a simpler interface around atomic.(Add|Store|Load|CompareAndSwap)Int32 functions.
type AtomicInt32 struct {
// contains filtered or unexported fields
}func NewAtomicInt32
func NewAtomicInt32(n int32) AtomicInt32NewAtomicInt32 initializes a new AtomicInt32 with a given value.
func (*AtomicInt32) Add
func (i *AtomicInt32) Add(n int32) int32Add atomically adds n to the value.
func (*AtomicInt32) CompareAndSwap
func (i *AtomicInt32) CompareAndSwap(oldval, newval int32) (swapped bool)CompareAndSwap atomatically swaps the old with the new value.
func (*AtomicInt32) Get
func (i *AtomicInt32) Get() int32Get atomically returns the current value.
func (*AtomicInt32) Set
func (i *AtomicInt32) Set(n int32)Set atomically sets n as new value.
type AtomicInt64
AtomicInt64 is a wrapper with a simpler interface around atomic.(Add|Store|Load|CompareAndSwap)Int64 functions.
type AtomicInt64 struct {
// contains filtered or unexported fields
}func NewAtomicInt64
func NewAtomicInt64(n int64) AtomicInt64NewAtomicInt64 initializes a new AtomicInt64 with a given value.
func (*AtomicInt64) Add
func (i *AtomicInt64) Add(n int64) int64Add atomically adds n to the value.
func (*AtomicInt64) CompareAndSwap
func (i *AtomicInt64) CompareAndSwap(oldval, newval int64) (swapped bool)CompareAndSwap atomatically swaps the old with the new value.
func (*AtomicInt64) Get
func (i *AtomicInt64) Get() int64Get atomically returns the current value.
func (*AtomicInt64) Set
func (i *AtomicInt64) Set(n int64)Set atomically sets n as new value.
type AtomicString
AtomicString gives you atomic-style APIs for string, but it's only a convenience wrapper that uses a mutex. So, it's not as efficient as the rest of the atomic types.
type AtomicString struct {
// contains filtered or unexported fields
}func (*AtomicString) CompareAndSwap
func (s *AtomicString) CompareAndSwap(oldval, newval string) (swqpped bool)CompareAndSwap atomatically swaps the old with the new value.
func (*AtomicString) Get
func (s *AtomicString) Get() stringGet atomically returns the current value.
func (*AtomicString) Set
func (s *AtomicString) Set(str string)Set atomically sets str as new value.
Generated by gomarkdoc