Documentation ¶
Index ¶
- type AtomicBoolean
- type AtomicInt32
- func (a *AtomicInt32) AddAndGet(delta int32) int32
- func (a *AtomicInt32) CompareAndSet(expect, update int32) bool
- func (a *AtomicInt32) DecrementAndGet() int32
- func (a *AtomicInt32) Get() int32
- func (a *AtomicInt32) GetAndAdd(delta int32) int32
- func (a *AtomicInt32) GetAndDecrement() int32
- func (a *AtomicInt32) GetAndIncrement() int32
- func (a *AtomicInt32) GetAndSet(newValue int32) (oldValue int32)
- func (a *AtomicInt32) IncrementAndGet() int32
- func (a *AtomicInt32) Set(newValue int32)
- func (a *AtomicInt32) String() string
- type AtomicInt64
- func (a *AtomicInt64) AddAndGet(delta int64) int64
- func (a *AtomicInt64) CompareAndSet(expect, update int64) bool
- func (a *AtomicInt64) DecrementAndGet() int64
- func (a *AtomicInt64) Get() int64
- func (a *AtomicInt64) GetAndAdd(delta int64) int64
- func (a *AtomicInt64) GetAndDecrement() int64
- func (a *AtomicInt64) GetAndIncrement() int64
- func (a *AtomicInt64) GetAndSet(newValue int64) int64
- func (a *AtomicInt64) IncrementAndGet() int64
- func (a *AtomicInt64) Set(newValue int64)
- func (a *AtomicInt64) String() string
- type OnTimeOut
- type TimingWheel
- func (tw *TimingWheel) AddTimer(when time.Time, interv time.Duration, to *OnTimeOut) int64
- func (tw *TimingWheel) CancelTimer(timerID int64)
- func (tw *TimingWheel) Size() int
- func (tw *TimingWheel) StartOnTimeOut()
- func (tw *TimingWheel) Stop()
- func (tw *TimingWheel) TimeOutChannel() chan *OnTimeOut
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AtomicBoolean ¶
type AtomicBoolean int32
AtomicBoolean provides atomic boolean type.
func NewAtomicBoolean ¶
func NewAtomicBoolean(initialValue bool) *AtomicBoolean
NewAtomicBoolean returns an atomic boolean type.
func (*AtomicBoolean) CompareAndSet ¶
func (a *AtomicBoolean) CompareAndSet(oldValue, newValue bool) bool
CompareAndSet compares boolean with expected value, if equals as expected then sets the updated value, this operation performs atomically.
func (*AtomicBoolean) Get ¶
func (a *AtomicBoolean) Get() bool
Get returns the value of boolean atomically.
func (*AtomicBoolean) GetAndSet ¶
func (a *AtomicBoolean) GetAndSet(newValue bool) bool
GetAndSet sets new value and returns the old atomically.
func (*AtomicBoolean) Set ¶
func (a *AtomicBoolean) Set(newValue bool)
Set sets the value of boolean atomically.
func (*AtomicBoolean) String ¶
func (a *AtomicBoolean) String() string
type AtomicInt32 ¶
type AtomicInt32 int32
AtomicInt32 provides atomic int32 type.
func NewAtomicInt32 ¶
func NewAtomicInt32(initialValue int32) *AtomicInt32
NewAtomicInt32 returns an atomoic int32 type.
func (*AtomicInt32) AddAndGet ¶
func (a *AtomicInt32) AddAndGet(delta int32) int32
AddAndGet adds the value by delta and then gets the value, this operation performs atomically.
func (*AtomicInt32) CompareAndSet ¶
func (a *AtomicInt32) CompareAndSet(expect, update int32) bool
CompareAndSet compares int64 with expected value, if equals as expected then sets the updated value, this operation performs atomically.
func (*AtomicInt32) DecrementAndGet ¶
func (a *AtomicInt32) DecrementAndGet() int32
DecrementAndGet decrements the value by 1 and then gets the value, this operation performs atomically.
func (*AtomicInt32) Get ¶
func (a *AtomicInt32) Get() int32
Get returns the value of int32 atomically.
func (*AtomicInt32) GetAndAdd ¶
func (a *AtomicInt32) GetAndAdd(delta int32) int32
GetAndAdd gets the old value and then add by delta, this operation performs atomically.
func (*AtomicInt32) GetAndDecrement ¶
func (a *AtomicInt32) GetAndDecrement() int32
GetAndDecrement gets the old value and then decrement by 1, this operation performs atomically.
func (*AtomicInt32) GetAndIncrement ¶
func (a *AtomicInt32) GetAndIncrement() int32
GetAndIncrement gets the old value and then increment by 1, this operation performs atomically.
func (*AtomicInt32) GetAndSet ¶
func (a *AtomicInt32) GetAndSet(newValue int32) (oldValue int32)
GetAndSet sets new value and returns the old atomically.
func (*AtomicInt32) IncrementAndGet ¶
func (a *AtomicInt32) IncrementAndGet() int32
IncrementAndGet increments the value by 1 and then gets the value, this operation performs atomically.
func (*AtomicInt32) Set ¶
func (a *AtomicInt32) Set(newValue int32)
Set sets the value of int32 atomically.
func (*AtomicInt32) String ¶
func (a *AtomicInt32) String() string
type AtomicInt64 ¶
type AtomicInt64 int64
AtomicInt64 provides atomic int64 type.
func NewAtomicInt64 ¶
func NewAtomicInt64(initialValue int64) *AtomicInt64
NewAtomicInt64 returns an atomic int64 type.
func (*AtomicInt64) AddAndGet ¶
func (a *AtomicInt64) AddAndGet(delta int64) int64
AddAndGet adds the value by delta and then gets the value, this operation performs atomically.
func (*AtomicInt64) CompareAndSet ¶
func (a *AtomicInt64) CompareAndSet(expect, update int64) bool
CompareAndSet compares int64 with expected value, if equals as expected then sets the updated value, this operation performs atomically.
func (*AtomicInt64) DecrementAndGet ¶
func (a *AtomicInt64) DecrementAndGet() int64
DecrementAndGet decrements the value by 1 and then gets the value, this operation performs atomically.
func (*AtomicInt64) Get ¶
func (a *AtomicInt64) Get() int64
Get returns the value of int64 atomically.
func (*AtomicInt64) GetAndAdd ¶
func (a *AtomicInt64) GetAndAdd(delta int64) int64
GetAndAdd gets the old value and then add by delta, this operation performs atomically.
func (*AtomicInt64) GetAndDecrement ¶
func (a *AtomicInt64) GetAndDecrement() int64
GetAndDecrement gets the old value and then decrement by 1, this operation performs atomically.
func (*AtomicInt64) GetAndIncrement ¶
func (a *AtomicInt64) GetAndIncrement() int64
GetAndIncrement gets the old value and then increment by 1, this operation performs atomically.
func (*AtomicInt64) GetAndSet ¶
func (a *AtomicInt64) GetAndSet(newValue int64) int64
GetAndSet sets new value and returns the old atomically.
func (*AtomicInt64) IncrementAndGet ¶
func (a *AtomicInt64) IncrementAndGet() int64
IncrementAndGet increments the value by 1 and then gets the value, this operation performs atomically.
func (*AtomicInt64) Set ¶
func (a *AtomicInt64) Set(newValue int64)
Set sets the value of int64 atomically.
func (*AtomicInt64) String ¶
func (a *AtomicInt64) String() string
type TimingWheel ¶
type TimingWheel struct {
// contains filtered or unexported fields
}
TimingWheel manages all the timed task.
func NewTimingWheel ¶
func NewTimingWheel(ctx context.Context) *TimingWheel
NewTimingWheel returns a *TimingWheel ready for use.
func (*TimingWheel) CancelTimer ¶
func (tw *TimingWheel) CancelTimer(timerID int64)
CancelTimer cancels a timed task with specified timer ID.
func (*TimingWheel) Size ¶
func (tw *TimingWheel) Size() int
Size returns the number of timed tasks.
func (*TimingWheel) StartOnTimeOut ¶
func (tw *TimingWheel) StartOnTimeOut()
func (*TimingWheel) TimeOutChannel ¶
func (tw *TimingWheel) TimeOutChannel() chan *OnTimeOut
TimeOutChannel returns the timeout channel.