Documentation
¶
Index ¶
- type IRTask
- type ITask
- type Progress
- type RTask
- func (f *RTask) Cancel()
- func (f *RTask) ChangeTask(fn func(f *IRTask))
- func (f *RTask) Id() uint
- func (f *RTask) IsCanceled() bool
- func (f *RTask) IsChanged() bool
- func (f *RTask) IsNotRunning() bool
- func (f *RTask) IsRunning() bool
- func (f *RTask) IsSuspended() bool
- func (f *RTask) Resume()
- func (f *RTask) Suspend()
- func (f *RTask) TryDo()
- type Task
- func (f *Task) Cancel()
- func (f *Task) ChangeTask(fn func(f *ITask) Progress)
- func (f *Task) Id() uint
- func (f *Task) IsCanceled() bool
- func (f *Task) IsChanged() bool
- func (f *Task) IsDone() bool
- func (f *Task) IsInProgress() bool
- func (f *Task) IsSuspended() bool
- func (f *Task) Resume()
- func (it *Task) Send(value interface{})
- func (f *Task) Suspend()
- func (f *Task) TryDo()
- func (f *Task) TryResolve(fn func(*Progress, bool))
- func (f *Task) WaitResolve(spin_delay uint, fn func(*Progress, bool))
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IRTask ¶ added in v1.1.5
type IRTask struct {
// contains filtered or unexported fields
}
Inner Runnable Task
func (*IRTask) ShouldCancel ¶ added in v1.1.5
Check if the runnable task should be canceled.
func (*IRTask) ShouldSuspend ¶ added in v1.1.5
Check if the runnable task should be suspended,
usually applied for a specific task with event loop in it.
do other things (switch) while the task is suspended or Wait() the task immediately.
type ITask ¶
type ITask struct {
// contains filtered or unexported fields
}
Inner Task
func (*ITask) Recv ¶ added in v1.1.0
Receive value from the outer task (if any, and will return nil if nothing).
func (*ITask) ShouldCancel ¶ added in v0.5.0
Check if progress of the task should be canceled.
func (*ITask) ShouldSuspend ¶ added in v0.5.0
Check if the task should be suspended,
usually applied for a specific task with event loop in it.
do other things (switch) while the task is suspended or Wait() the task immediately.
type Progress ¶
type Progress struct {
// contains filtered or unexported fields
}
Progress of the task
func (*Progress) OnComplete ¶ added in v0.5.0
Indicates the task is completed
type RTask ¶ added in v1.1.5
type RTask struct {
// contains filtered or unexported fields
}
Runnable task
func (*RTask) Cancel ¶ added in v1.1.5
func (f *RTask) Cancel()
Send signal to the inner runnable handle that the task should be canceled.
this won't do anything if not explicitly configured inside the task.
func (*RTask) ChangeTask ¶ added in v1.1.5
Change the runnable task, make sure the task isn't running.
func (*RTask) IsCanceled ¶ added in v1.1.5
Check if the runnable task is canceled
func (*RTask) IsNotRunning ¶ added in v1.1.5
Check if the runnable task is not running anymore (or done)
func (*RTask) IsSuspended ¶ added in v1.1.5
Check if the task is suspended
func (*RTask) Resume ¶ added in v1.1.5
func (f *RTask) Resume()
Resume the suspended runnable task.
this won't do anything if not explicitly configured inside the task.
type Task ¶
type Task struct {
// contains filtered or unexported fields
}
Future task
func (*Task) Cancel ¶
func (f *Task) Cancel()
Send signal to the inner task that the task should be canceled.
this won't do anything if not explicitly configured inside the task.
func (*Task) ChangeTask ¶ added in v0.5.0
Change task, make sure the task isn't in progress.
func (*Task) IsSuspended ¶ added in v0.5.0
Check if the task is suspended
func (*Task) Resume ¶ added in v0.5.0
func (f *Task) Resume()
Resume the suspended task.
this won't do anything if not explicitly configured inside the task.
func (*Task) Send ¶ added in v1.1.0
func (it *Task) Send(value interface{})
Send value to the inner task
func (*Task) Suspend ¶ added in v0.5.0
func (f *Task) Suspend()
Send signal to the inner task that the task should be suspended.
this won't do anything if not explicitly configured inside the task.
func (*Task) TryDo ¶
func (f *Task) TryDo()
Try do the task now (it won't block the current thread)
and then TryResolve later.
func (*Task) TryResolve ¶
Try resolve progress of the future task (non-blocking)
func (*Task) WaitResolve ¶ added in v1.0.0
Careful! this is blocking operation, resolve progress of the future task (will "block" until the task is completed).
if spin_delay < 3 milliseconds, spin_delay value will be 3 milliseconds, set it large than that or accordingly.
due to blocking operation nature this fn only return whether the task is canceled, completed or error. current progress (sender) will be ignored.