Documentation
¶
Index ¶
- type Int
- type IntChan
- func (st *IntChan) EnqueueToRunAfterCurrentTriggerFunctions(fn concurrentIntFunc)
- func (st *IntChan) GetTriggerOnValue(value int, name string) concurrentIntFunc
- func (st *IntChan) GetValue() int
- func (st *IntChan) SetTriggerOnValue(value int, name string, fn concurrentIntFunc)
- func (st *IntChan) UnsetTriggerOnValue(value int, name string)
- func (st *IntChan) UnsetTriggersOnValue(value int)
- func (st *IntChan) Update(value int)
- type IntMutex
- func (st *IntMutex) EnqueueToRunAfterCurrentTriggerFunctions(fn concurrentIntFunc)
- func (st *IntMutex) GetTriggerOnValue(value int, name string) concurrentIntFunc
- func (st *IntMutex) GetValue() int
- func (st *IntMutex) SetTriggerOnValue(value int, name string, fn concurrentIntFunc)
- func (st *IntMutex) UnsetTriggerOnValue(value int, name string)
- func (st *IntMutex) UnsetTriggersOnValue(value int)
- func (st *IntMutex) Update(upd int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Int ¶
type Int interface {
// GetValue returns the current value of the counter
GetValue() int
// Update updates the counter with the given value
Update(upd int)
// GetTriggerOnValue returns the trigger function for the given value and name
GetTriggerOnValue(value int, name string) concurrentIntFunc
// SetTriggerOnValue sets a trigger function to be executed when the counter reaches the given value
SetTriggerOnValue(value int, name string, fn concurrentIntFunc)
// UnsetTriggerOnValue removes the trigger function for the given value and name
UnsetTriggerOnValue(value int, name string)
// UnsetTriggersOnValue removes all trigger functions for the given value
UnsetTriggersOnValue(value int)
// EnqueueToRunAfterCurrentTriggerFunctions enqueues the given function to be executed after the triggered functions. This function is executed only once.
EnqueueToRunAfterCurrentTriggerFunctions(fn concurrentIntFunc)
// contains filtered or unexported methods
}
type IntChan ¶
type IntChan struct {
// contains filtered or unexported fields
}
concurrent safe Int
func NewIntChan ¶
func (*IntChan) EnqueueToRunAfterCurrentTriggerFunctions ¶
func (st *IntChan) EnqueueToRunAfterCurrentTriggerFunctions(fn concurrentIntFunc)
EnqueueToRunAfterCurrentTriggerFunctions enqueues a function to be executed just after the trigger functions
func (*IntChan) GetTriggerOnValue ¶
func (*IntChan) SetTriggerOnValue ¶
func (*IntChan) UnsetTriggerOnValue ¶
func (*IntChan) UnsetTriggersOnValue ¶
type IntMutex ¶
type IntMutex struct {
// contains filtered or unexported fields
}
IntMutex defines a concurrent-safe int
func NewIntMutex ¶
NewIntMutex creates and returns a *concurrentInt
func (*IntMutex) EnqueueToRunAfterCurrentTriggerFunctions ¶
func (st *IntMutex) EnqueueToRunAfterCurrentTriggerFunctions(fn concurrentIntFunc)
EnqueueToRunAfterCurrentTriggerFunctions enqueues a function to be executed just after the trigger functions
func (*IntMutex) GetTriggerOnValue ¶
GetTriggerOnValue returns the trigger function associated to the given value-name. It returns nil if no function is associated to the given values.
func (*IntMutex) SetTriggerOnValue ¶
SetTriggerOnValue sets a trigger that would be executed once the given value were reached. Note: do not call UnsetTriggerOnValue() as part of the given function (it would arrive to a deadlock scenario), instead enqueue a function (using EnqueueToRunAfterCurrentTriggerFunctions()) that call it.
func (*IntMutex) UnsetTriggerOnValue ¶
UnsetTriggerOnValue removes the function to be executed on a value
func (*IntMutex) UnsetTriggersOnValue ¶
UnsetTriggersOnValue removes all function to be executed on a given value