Documentation
¶
Index ¶
- Constants
- func AddInt(addr *int, delta int) (new int)
- func AddUint(addr *uint, delta uint) (new uint)
- func CompareAndSwapInt(addr *int, old, new int) (swapped bool)
- func CompareAndSwapUint(addr *uint, old, new uint) (swapped bool)
- func LoadInt(addr *int) (val int)
- func LoadUint(addr *uint) (val uint)
- func StoreInt(addr *int, val int)
- func StoreUint(addr *uint, val uint)
- func SwapInt(addr *int, new int) (old int)
- func SwapUint(addr *uint, new uint) (old uint)
- type AlignedInt32
- func (a *AlignedInt32) Add(n int32) int32
- func (a *AlignedInt32) CAS(old, new int32) bool
- func (a *AlignedInt32) Dec() int32
- func (a *AlignedInt32) Inc() int32
- func (a *AlignedInt32) Load() int32
- func (a *AlignedInt32) Store(n int32)
- func (a *AlignedInt32) String() string
- func (a *AlignedInt32) Sub(n int32) int32
- func (a *AlignedInt32) Swap(n int32) int32
- type AlignedInt64
- func (a *AlignedInt64) Add(n int64) int64
- func (a *AlignedInt64) CAS(old, new int64) bool
- func (a *AlignedInt64) Dec() int64
- func (a *AlignedInt64) Inc() int64
- func (a *AlignedInt64) Load() int64
- func (a *AlignedInt64) Store(n int64)
- func (a *AlignedInt64) String() string
- func (a *AlignedInt64) Sub(n int64) int64
- func (a *AlignedInt64) Swap(n int64) int64
- type Bool
- type Complex64
- type Duration
- func (d *Duration) Add(dur time.Duration) time.Duration
- func (d *Duration) CAS(old, new time.Duration) bool
- func (d *Duration) Load() time.Duration
- func (d *Duration) Store(dur time.Duration)
- func (d *Duration) String() string
- func (d *Duration) Sub(dur time.Duration) time.Duration
- func (d *Duration) Swap(dur time.Duration) time.Duration
- func (d *Duration) SwapGreater(new time.Duration) (old time.Duration, swapped bool)
- func (d *Duration) SwapLess(new time.Duration) (old time.Duration, swapped bool)
- type Error
- type Float32
- func (f *Float32) Add(s float32) float32
- func (f *Float32) CAS(old, new float32) bool
- func (f *Float32) Load() float32
- func (f *Float32) Store(s float32)
- func (f *Float32) String() string
- func (f *Float32) Sub(s float32) float32
- func (f *Float32) SwapGreater(new float32) (old float32, swapped bool)
- func (f *Float32) SwapLess(new float32) (old float32, swapped bool)
- type Float64
- func (f *Float64) Add(s float64) float64
- func (f *Float64) CAS(old, new float64) bool
- func (f *Float64) Load() float64
- func (f *Float64) Store(s float64)
- func (f *Float64) String() string
- func (f *Float64) Sub(s float64) float64
- func (f *Float64) SwapGreater(new float64) (old float64, swapped bool)
- func (f *Float64) SwapLess(new float64) (old float64, swapped bool)
- type Int
- func (i *Int) Add(n int) int
- func (i *Int) CAS(old, new int) bool
- func (i *Int) Dec() int
- func (i *Int) Inc() int
- func (i *Int) Load() int
- func (i *Int) Store(n int)
- func (i *Int) String() string
- func (i *Int) Sub(n int) int
- func (i *Int) Swap(n int) int
- func (i *Int) SwapGreater(new int) (old int, swapped bool)
- func (i *Int) SwapLess(new int) (old int, swapped bool)
- type Int32
- func (i *Int32) Add(n int32) int32
- func (i *Int32) CAS(old, new int32) bool
- func (i *Int32) Dec() int32
- func (i *Int32) Inc() int32
- func (i *Int32) Load() int32
- func (i *Int32) Store(n int32)
- func (i *Int32) String() string
- func (i *Int32) Sub(n int32) int32
- func (i *Int32) Swap(n int32) int32
- func (i *Int32) SwapGreater(new int32) (old int32, swapped bool)
- func (i *Int32) SwapLess(new int32) (old int32, swapped bool)
- type Int64
- func (i *Int64) Add(n int64) int64
- func (i *Int64) CAS(old, new int64) bool
- func (i *Int64) Dec() int64
- func (i *Int64) Inc() int64
- func (i *Int64) Load() int64
- func (i *Int64) Store(n int64)
- func (i *Int64) String() string
- func (i *Int64) Sub(n int64) int64
- func (i *Int64) Swap(n int64) int64
- func (i *Int64) SwapGreater(new int64) (old int64, swapped bool)
- func (i *Int64) SwapLess(new int64) (old int64, swapped bool)
- type String
- type Time
- type Uint
- func (i *Uint) Add(n uint) uint
- func (i *Uint) CAS(old, new uint) bool
- func (i *Uint) Dec() uint
- func (i *Uint) Inc() uint
- func (i *Uint) Load() uint
- func (i *Uint) Store(n uint)
- func (i *Uint) String() string
- func (i *Uint) Sub(n uint) uint
- func (i *Uint) Swap(n uint) uint
- func (i *Uint) SwapGreater(new uint) (old uint, swapped bool)
- func (i *Uint) SwapLess(new uint) (old uint, swapped bool)
- type Uint32
- func (u *Uint32) Add(n uint32) uint32
- func (u *Uint32) CAS(old, new uint32) bool
- func (u *Uint32) Dec() uint32
- func (u *Uint32) Inc() uint32
- func (u *Uint32) Load() uint32
- func (u *Uint32) Store(n uint32)
- func (u *Uint32) String() string
- func (u *Uint32) Sub(n uint32) uint32
- func (u *Uint32) Swap(n uint32) uint32
- func (u *Uint32) SwapGreater(new uint32) (old uint32, swapped bool)
- func (u *Uint32) SwapLess(new uint32) (old uint32, swapped bool)
- type Uint64
- func (u *Uint64) Add(n uint64) uint64
- func (u *Uint64) CAS(old, new uint64) bool
- func (u *Uint64) Dec() uint64
- func (u *Uint64) Inc() uint64
- func (u *Uint64) Load() uint64
- func (u *Uint64) Store(n uint64)
- func (u *Uint64) String() string
- func (u *Uint64) Sub(n uint64) uint64
- func (u *Uint64) Swap(n uint64) uint64
- func (u *Uint64) SwapGreater(new uint64) (old uint64, swapped bool)
- func (u *Uint64) SwapLess(new uint64) (old uint64, swapped bool)
- type Uintptr
- type UnsafePointer
- type Value
Constants ¶
const CacheLine = cacheLineBytes
CacheLine of the CPU. See aligned_cachelineXXX.go files
Variables ¶
This section is empty.
Functions ¶
func AddInt ¶ added in v0.8.0
AddInt is same as atomic.AddInt32 or atomic.AddInt64 but for int type.
func AddUint ¶ added in v0.8.0
AddUint is same as atomic.AddUint32 or atomic.AddUint64 but for uint.
func CompareAndSwapInt ¶ added in v0.8.0
CompareAndSwapInt is same as atomic.CompareAndSwapInt32 or atomic.CompareAndSwapInt64 but for int type.
func CompareAndSwapUint ¶ added in v0.8.0
CompareAndSwapUint is same as atomic.CompareAndSwapUint32 or atomic.CompareAndSwapUint64 but for uint.
func LoadInt ¶ added in v0.8.0
LoadInt is same as atomic.LoadInt32 or atomic.LoadInt64 but for int type.
func LoadUint ¶ added in v0.8.0
LoadUint is same as atomic.LoadUint32 or atomic.LoadUint64 but for uint.
func StoreInt ¶ added in v0.8.0
StoreInt is same as atomic.StoreInt32 or atomic.StoreInt64 but for int type.
func StoreUint ¶ added in v0.8.0
StoreUint is same as atomic.StoreUint32 or atomic.StoreUint64 but for uint.
func SwapInt ¶ added in v0.8.0
SwapInt is same as atomic.SwapInt32 or atomic.SwapInt64 but for int type.
func SwapUint ¶ added in v0.8.0
SwapUint is same as atomic.SwapUint32 or atomic.SwapUint64 but for uint.
Types ¶
type AlignedInt32 ¶ added in v0.7.0
type AlignedInt32 struct {
// contains filtered or unexported fields
}
AlignedInt32 is an atomic wrapper around an int32 aligned to a cache line.
func NewAlignedInt32 ¶ added in v0.7.0
func NewAlignedInt32(i int32) *AlignedInt32
NewAlignedInt32 creates an AlignedInt32.
func (*AlignedInt32) Add ¶ added in v0.7.0
func (a *AlignedInt32) Add(n int32) int32
Add atomically and return the new value.
func (*AlignedInt32) CAS ¶ added in v0.7.0
func (a *AlignedInt32) CAS(old, new int32) bool
CAS is an atomic Compare-And-Swap operation.
func (*AlignedInt32) Dec ¶ added in v0.7.0
func (a *AlignedInt32) Dec() int32
Dec atomically and return the new value.
func (*AlignedInt32) Inc ¶ added in v0.7.0
func (a *AlignedInt32) Inc() int32
Inc atomically and return the new value.
func (*AlignedInt32) Load ¶ added in v0.7.0
func (a *AlignedInt32) Load() int32
Load atomically the value.
func (*AlignedInt32) Store ¶ added in v0.7.0
func (a *AlignedInt32) Store(n int32)
Store atomically the given value.
func (*AlignedInt32) String ¶ added in v0.7.0
func (a *AlignedInt32) String() string
func (*AlignedInt32) Sub ¶ added in v0.7.0
func (a *AlignedInt32) Sub(n int32) int32
Sub atomically and return the new value.
func (*AlignedInt32) Swap ¶ added in v0.7.0
func (a *AlignedInt32) Swap(n int32) int32
Swap atomically and return the old value.
type AlignedInt64 ¶ added in v0.6.0
type AlignedInt64 struct {
// contains filtered or unexported fields
}
AlignedInt64 is an atomic wrapper around an int64 aligned to a cache line.
func NewAlignedInt64 ¶ added in v0.6.0
func NewAlignedInt64(i int64) *AlignedInt64
NewAlignedInt64 creates an AlignedInt64.
func (*AlignedInt64) Add ¶ added in v0.6.0
func (a *AlignedInt64) Add(n int64) int64
Add atomically and return the new value.
func (*AlignedInt64) CAS ¶ added in v0.6.0
func (a *AlignedInt64) CAS(old, new int64) bool
CAS is an atomic Compare-And-Swap operation.
func (*AlignedInt64) Dec ¶ added in v0.6.0
func (a *AlignedInt64) Dec() int64
Dec atomically and return the new value.
func (*AlignedInt64) Inc ¶ added in v0.6.0
func (a *AlignedInt64) Inc() int64
Inc atomically and return the new value.
func (*AlignedInt64) Load ¶ added in v0.6.0
func (a *AlignedInt64) Load() int64
Load atomically the value.
func (*AlignedInt64) Store ¶ added in v0.6.0
func (a *AlignedInt64) Store(n int64)
Store atomically the given value.
func (*AlignedInt64) String ¶ added in v0.6.0
func (a *AlignedInt64) String() string
func (*AlignedInt64) Sub ¶ added in v0.6.0
func (a *AlignedInt64) Sub(n int64) int64
Sub atomically and return the new value.
func (*AlignedInt64) Swap ¶ added in v0.6.0
func (a *AlignedInt64) Swap(n int64) int64
Swap atomically and return the old value.
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
Bool is an atomic boolean.
type Complex64 ¶
type Complex64 struct {
// contains filtered or unexported fields
}
Complex64 is an atomic wrapper around float32.
type Duration ¶ added in v0.2.0
type Duration struct {
// contains filtered or unexported fields
}
Duration is an atomic wrapper around an time.Duration.
func NewDuration ¶ added in v0.2.0
NewDuration creates a Duration.
func (*Duration) SwapGreater ¶ added in v0.8.0
SwapGreater value atomically, returns old and swap result.
type Error ¶ added in v0.4.0
type Error struct {
// contains filtered or unexported fields
}
Error is an atomic wrapper around error.
func NewError ¶ added in v0.4.0
NewError creates an Error. Cannot store nil after first non-nil store.
type Float32 ¶
type Float32 struct {
// contains filtered or unexported fields
}
Float32 is an atomic wrapper around float32.
func (*Float32) SwapGreater ¶ added in v0.8.0
SwapGreater value atomically, returns old and swap result.
type Float64 ¶
type Float64 struct {
// contains filtered or unexported fields
}
Float64 is an atomic wrapper around float64.
func (*Float64) SwapGreater ¶ added in v0.8.0
SwapGreater value atomically, returns old and swap result.
type Int ¶ added in v0.8.0
type Int struct {
// contains filtered or unexported fields
}
Int is an atomic wrapper around an int.
func (*Int) SwapGreater ¶ added in v0.8.0
SwapGreater value atomically, returns old and swap result.
type Int32 ¶
type Int32 struct {
// contains filtered or unexported fields
}
Int32 is an atomic wrapper around an int32.
func (*Int32) SwapGreater ¶ added in v0.8.0
SwapGreater value atomically, returns old and swap result.
type Int64 ¶
type Int64 struct {
// contains filtered or unexported fields
}
Int64 is an atomic wrapper around an int64.
func (*Int64) SwapGreater ¶ added in v0.8.0
SwapGreater value atomically, returns old and swap result.
type String ¶
type String struct {
// contains filtered or unexported fields
}
String is an atomic wrapper around a string.
type Time ¶ added in v0.4.0
type Time struct {
// contains filtered or unexported fields
}
Time is an atomic wrapper around an time.Time.
type Uint ¶ added in v0.8.0
type Uint struct {
// contains filtered or unexported fields
}
Uint is an atomic wrapper around an uint.
func (*Uint) SwapGreater ¶ added in v0.8.0
SwapGreater value atomically, returns old and swap result.
type Uint32 ¶
type Uint32 struct {
// contains filtered or unexported fields
}
Uint32 is an atomic wrapper around an uint32.
func (*Uint32) SwapGreater ¶ added in v0.8.0
SwapGreater value atomically, returns old and swap result.
type Uint64 ¶
type Uint64 struct {
// contains filtered or unexported fields
}
Uint64 is an atomic wrapper around an uint64.
func (*Uint64) SwapGreater ¶ added in v0.8.0
SwapGreater value atomically, returns old and swap result.
type Uintptr ¶ added in v0.2.0
type Uintptr struct {
// contains filtered or unexported fields
}
Uintptr is an atomic uintptr.
func NewUintptr ¶ added in v0.2.0
NewUintptr creates an Uintptr.
type UnsafePointer ¶ added in v0.4.0
type UnsafePointer struct {
// contains filtered or unexported fields
}
UnsafePointer is an atomic unsafe.Pointer.
func NewUnsafePointer ¶ added in v0.4.0
func NewUnsafePointer(value unsafe.Pointer) *UnsafePointer
NewUnsafePointer creates an UnsafePointer.
func (*UnsafePointer) CAS ¶ added in v0.4.0
func (p *UnsafePointer) CAS(old, new unsafe.Pointer) bool
CAS is an atomic Compare-And-Swap operation.
func (*UnsafePointer) Load ¶ added in v0.4.0
func (p *UnsafePointer) Load() unsafe.Pointer
Load atomically the value.
func (*UnsafePointer) Store ¶ added in v0.4.0
func (p *UnsafePointer) Store(new unsafe.Pointer)
Store atomically the given value.