Documentation
¶
Overview ¶
Package atomic provides simple wrappers for `sync/atomic` to enforce atomic access.
Index ¶
- type Bool
- type Duration
- func (x *Duration) Add(delta time.Duration) time.Duration
- func (x *Duration) CompareAndSwap(old, new time.Duration) bool
- func (x *Duration) Load() time.Duration
- func (x *Duration) MarshalJSON() ([]byte, error)
- func (x *Duration) Store(val time.Duration)
- func (x *Duration) Swap(new time.Duration) time.Duration
- type Float32
- type Float64
- type Int32
- type Int64
- type MarshalPointer
- type MarshalTime
- type MarshalValue
- type Pointer
- func (p *Pointer) CompareAndSwap(old, new unsafe.Pointer) (swapped bool)
- func (p *Pointer) Load() (val unsafe.Pointer)
- func (p *Pointer) MarshalJSON() ([]byte, error)
- func (p *Pointer) SetMarshalJSON(fn MarshalPointer)
- func (p *Pointer) Store(val unsafe.Pointer)
- func (p *Pointer) Swap(new unsafe.Pointer) (old unsafe.Pointer)
- type String
- type Time
- type Uint32
- type Uint64
- type Uintptr
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
A Bool is an atomic bool value.
func (*Bool) CompareAndSwap ¶
CompareAndSwap executes the compare-and-swap operation for x.
func (*Bool) MarshalJSON ¶ added in v1.1.2
MarshalJSON returns the JSON encoding of x.
type Duration ¶
type Duration struct {
// contains filtered or unexported fields
}
A Duration is an atomic time.Duration value.
func (*Duration) CompareAndSwap ¶
CompareAndSwap executes the compare-and-swap operation for x.
func (*Duration) MarshalJSON ¶ added in v1.1.2
MarshalJSON returns the JSON encoding of x.
type Float32 ¶
type Float32 struct {
// contains filtered or unexported fields
}
A Float32 is an atomic float32 value.
func (*Float32) CompareAndSwap ¶
CompareAndSwap executes the compare-and-swap operation for x.
func (*Float32) MarshalJSON ¶ added in v1.1.2
MarshalJSON returns the JSON encoding of x.
type Float64 ¶
type Float64 struct {
// contains filtered or unexported fields
}
A Float64 is an atomic float64 value.
func (*Float64) CompareAndSwap ¶
CompareAndSwap executes the compare-and-swap operation for x.
func (*Float64) MarshalJSON ¶ added in v1.1.2
MarshalJSON returns the JSON encoding of x.
type Int32 ¶
type Int32 struct {
// contains filtered or unexported fields
}
An Int32 is an atomic int32 value.
func (*Int32) CompareAndSwap ¶
CompareAndSwap executes the compare-and-swap operation for x.
func (*Int32) MarshalJSON ¶ added in v1.1.2
MarshalJSON returns the JSON encoding of x.
type Int64 ¶
type Int64 struct {
// contains filtered or unexported fields
}
An Int64 is an atomic int64 value.
func (*Int64) CompareAndSwap ¶
CompareAndSwap executes the compare-and-swap operation for x.
func (*Int64) MarshalJSON ¶ added in v1.1.2
MarshalJSON returns the JSON encoding of x.
type MarshalValue ¶ added in v1.1.3
type Pointer ¶ added in v1.1.2
type Pointer struct {
// contains filtered or unexported fields
}
A Pointer is an atomic pointer value.
func (*Pointer) CompareAndSwap ¶ added in v1.1.2
CompareAndSwap executes the compare-and-swap operation for x.
func (*Pointer) MarshalJSON ¶ added in v1.1.3
MarshalJSON returns the JSON encoding of x.
func (*Pointer) SetMarshalJSON ¶ added in v1.1.3
func (p *Pointer) SetMarshalJSON(fn MarshalPointer)
SetMarshalJSON sets the JSON encoding handler for x.
type String ¶ added in v1.1.2
type String struct {
// contains filtered or unexported fields
}
A String is an atomic string value.
func (*String) MarshalJSON ¶ added in v1.1.2
MarshalJSON returns the JSON encoding of x.
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
A Time is an atomic time.Time value.
func (*Time) MarshalJSON ¶ added in v1.1.2
MarshalJSON returns the JSON encoding of x.
func (*Time) SetMarshalJSON ¶ added in v1.1.3
func (x *Time) SetMarshalJSON(fn MarshalTime)
SetMarshalJSON sets the JSON encoding handler for x.
type Uint32 ¶
type Uint32 struct {
// contains filtered or unexported fields
}
An Uint32 is an atomic uint32 value.
func (*Uint32) CompareAndSwap ¶
CompareAndSwap executes the compare-and-swap operation for x.
func (*Uint32) MarshalJSON ¶ added in v1.1.2
MarshalJSON returns the JSON encoding of x.
type Uint64 ¶
type Uint64 struct {
// contains filtered or unexported fields
}
An Uint64 is an atomic uint64 value.
func (*Uint64) CompareAndSwap ¶
CompareAndSwap executes the compare-and-swap operation for x.
func (*Uint64) MarshalJSON ¶ added in v1.1.2
MarshalJSON returns the JSON encoding of x.
type Uintptr ¶
type Uintptr struct {
// contains filtered or unexported fields
}
An Uintptr is an atomic uintptr value.
func (*Uintptr) CompareAndSwap ¶
CompareAndSwap executes the compare-and-swap operation for x.
type Value ¶
A Value provides an atomic load and store of a consistently typed value.
func (*Value) MarshalJSON ¶ added in v1.1.3
MarshalJSON returns the JSON encoding of x.
func (*Value) SetMarshalJSON ¶ added in v1.1.3
func (x *Value) SetMarshalJSON(fn MarshalValue)
SetMarshalJSON sets the JSON encoding handler for x.