Documentation
¶
Index ¶
- Variables
- type AtomicBool
- type AtomicInt32
- type AtomicUint64
- type Set
- type Task
- func (t *Task) Cancel()
- func (t *Task) Err() error
- func (t *Task) ErrUnsafe() error
- func (t *Task) Finished() bool
- func (t *Task) Initialize(id TaskId, name string, runTimeout time.Duration, ...) *Task
- func (t *Task) MustWaitFinishWithContext(ctx context.Context)
- func (t *Task) OnFinished(g func())
- func (t *Task) Result() interface{}
- func (t *Task) Run() error
- func (t *Task) WaitFinish()
- func (t *Task) WaitFinishWithContext(ctx context.Context) bool
- type TaskId
Constants ¶
This section is empty.
Variables ¶
var ( InvalidTaskResult = &struct{}{} DummyTaskResult = struct{}{} )
Functions ¶
This section is empty.
Types ¶
type AtomicBool ¶
type AtomicBool struct {
// contains filtered or unexported fields
}
AtomicBool gives an atomic boolean variable.
func NewAtomicBool ¶
func NewAtomicBool(n bool) AtomicBool
NewAtomicBool initializes a new AtomicBool with a given value.
func (*AtomicBool) CompareAndSwap ¶
func (i *AtomicBool) CompareAndSwap(o, n bool) bool
CompareAndSwap automatically swaps the old with the new value.
type AtomicInt32 ¶
type AtomicInt32 struct {
// contains filtered or unexported fields
}
AtomicInt32 is a wrapper with a simpler interface around atomic.(Add|Store|Load|CompareAndSwap)Int32 functions.
func NewAtomicInt32 ¶
func NewAtomicInt32(n int32) AtomicInt32
NewAtomicInt32 initializes a new AtomicInt32 with a given value.
func (*AtomicInt32) Add ¶
func (i *AtomicInt32) Add(n int32) int32
Add atomically adds n to the value.
func (*AtomicInt32) CompareAndSwap ¶
func (i *AtomicInt32) CompareAndSwap(oldVal, newVal int32) (swapped bool)
CompareAndSwap automatically swaps the old with the new value.
func (*AtomicInt32) Get ¶
func (i *AtomicInt32) Get() int32
Get atomically returns the current value.
type AtomicUint64 ¶
type AtomicUint64 struct {
// contains filtered or unexported fields
}
AtomicUint64 is a wrapper with a simpler interface around atomic.(Add|Store|Load|CompareAndSwap)Uint64 functions.
func NewAtomicUint64 ¶
func NewAtomicUint64(n uint64) AtomicUint64
NewAtomicUint64 initializes a new AtomicUint64 with a given value.
func (*AtomicUint64) Add ¶
func (i *AtomicUint64) Add(n uint64) uint64
Add atomically adds n to the value.
func (*AtomicUint64) CompareAndSwap ¶
func (i *AtomicUint64) CompareAndSwap(oldVal, newVal uint64) (swapped bool)
CompareAndSwap automatically swaps the old with the new value.
func (*AtomicUint64) Get ¶
func (i *AtomicUint64) Get() uint64
Get atomically returns the current value.
type Task ¶
type Task struct { ID TaskId Name string Data interface{} // contains filtered or unexported fields }
func NewTaskNoResult ¶
func (*Task) Initialize ¶
func (*Task) MustWaitFinishWithContext ¶
func (*Task) OnFinished ¶
func (t *Task) OnFinished(g func())
func (*Task) WaitFinish ¶
func (t *Task) WaitFinish()