Skip to content

Import path: gitlab.soludian.com/soludian/fountain/libs/fsync/fatomic

fatomic

go
import "gitlab.soludian.com/soludian/fountain/libs/fsync/fatomic"

Index

type AtomicBool

AtomicBool gives an atomic boolean variable.

go
type AtomicBool struct {
    // contains filtered or unexported fields
}

func NewAtomicBool

go
func NewAtomicBool(n bool) AtomicBool

NewAtomicBool initializes a new AtomicBool with a given value.

func (*AtomicBool) Get

go
func (i *AtomicBool) Get() bool

Get atomically returns the current value.

func (*AtomicBool) Set

go
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.

go
type AtomicDuration struct {
    // contains filtered or unexported fields
}

func NewAtomicDuration

go
func NewAtomicDuration(duration time.Duration) AtomicDuration

NewAtomicDuration initializes a new AtomicDuration with a given value.

func (*AtomicDuration) Add

go
func (d *AtomicDuration) Add(duration time.Duration) time.Duration

Add atomically adds duration to the value.

func (*AtomicDuration) CompareAndSwap

go
func (d *AtomicDuration) CompareAndSwap(oldval, newval time.Duration) (swapped bool)

CompareAndSwap atomatically swaps the old with the new value.

func (*AtomicDuration) Get

go
func (d *AtomicDuration) Get() time.Duration

Get atomically returns the current value.

func (*AtomicDuration) Set

go
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.

go
type AtomicInt32 struct {
    // contains filtered or unexported fields
}

func NewAtomicInt32

go
func NewAtomicInt32(n int32) AtomicInt32

NewAtomicInt32 initializes a new AtomicInt32 with a given value.

func (*AtomicInt32) Add

go
func (i *AtomicInt32) Add(n int32) int32

Add atomically adds n to the value.

func (*AtomicInt32) CompareAndSwap

go
func (i *AtomicInt32) CompareAndSwap(oldval, newval int32) (swapped bool)

CompareAndSwap atomatically swaps the old with the new value.

func (*AtomicInt32) Get

go
func (i *AtomicInt32) Get() int32

Get atomically returns the current value.

func (*AtomicInt32) Set

go
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.

go
type AtomicInt64 struct {
    // contains filtered or unexported fields
}

func NewAtomicInt64

go
func NewAtomicInt64(n int64) AtomicInt64

NewAtomicInt64 initializes a new AtomicInt64 with a given value.

func (*AtomicInt64) Add

go
func (i *AtomicInt64) Add(n int64) int64

Add atomically adds n to the value.

func (*AtomicInt64) CompareAndSwap

go
func (i *AtomicInt64) CompareAndSwap(oldval, newval int64) (swapped bool)

CompareAndSwap atomatically swaps the old with the new value.

func (*AtomicInt64) Get

go
func (i *AtomicInt64) Get() int64

Get atomically returns the current value.

func (*AtomicInt64) Set

go
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.

go
type AtomicString struct {
    // contains filtered or unexported fields
}

func (*AtomicString) CompareAndSwap

go
func (s *AtomicString) CompareAndSwap(oldval, newval string) (swqpped bool)

CompareAndSwap atomatically swaps the old with the new value.

func (*AtomicString) Get

go
func (s *AtomicString) Get() string

Get atomically returns the current value.

func (*AtomicString) Set

go
func (s *AtomicString) Set(str string)

Set atomically sets str as new value.

Generated by gomarkdoc