Constructor
Ensures extensions are reset to initial state when task is assigned to new worker fiber.
Resumes this task, calls extension methods before resuming (if there are any).
Suspends this task, calls extension methods before and after suspending (if there are any).
Reserved index field which ensures that any Task derivative can be used with ObjectPool. That comes at minor cost of one unused size_t per Task instance if not needed which is not a problem.
Fiber this task executes in
Assigns the task to a fiber. In most cases you need to use Scheduler.schedule instead.
Suspends execution of this task.
Resumes execution of this task. If task has not been started yet, starts it.
Registers a termination hook that will be executed when the Task is killed.
Unregisters a termination hook that would be executed when the Task is killed.
Forces abnormal termination for the task by throwing special exception instance.
Method that will be run by scheduler when task finishes. Must be overridden by specific task class to reset reusable resources.
Method that must be overridden in actual application/library task classes to provide entry point.
Internal wrapper around this.run() which is used as primary fiber entry point and ensures any uncaught exception propagates to the context that has started this task.
variadic template argument list of extensions to use
// see tests/examples in ocean.task.extensions.*
Task descendant which supports extensions that alter the semantics of suspending and resuming the task. An arbitrary number of extensions may be specified (see Params).
Each extension must be a struct which defines one or more of the following methods: - void onBeforeSuspend ( ) - void onBeforeResume ( ) - void onResumed ( ) // called right after execution gets back to task
There is no onSuspended hook because it would be executed in the context of the caller fiber, right after the current task yields. Such a context tends to be neither well-defined nor useful in practice.
The relevant extension methods are called before this.suspend / this.resume in the same order as they are supplied via the template argument list.
The relevant extension methods are called after this.suspend / this.resume in the reverse order that they are supplied via the template argument list.