System::Threading::Tasks::Task class
Contents
[
Hide
]Task class
Represents an asynchronous operation that can be awaited and composed with other tasks.
class Task : public System::IDisposable
Methods
Method | Description |
---|---|
Activate(TaskScheduler *) | Activates the task for execution on a scheduler. |
AddContinuation(const Action<>&) | Adds a continuation action to be executed upon completion. |
Complete() | Marks the task as completed and finishes task. |
ConfigureAwait(bool) const | Configures how awaits on this task should behave regarding context capture. |
ContinueWith(const Action<TaskPtr>&) | Creates a continuation that executes when the task completes. |
Dispose() override | Releases resources associated with the task. |
Execute() | Executes the task’s function. |
get_AsyncState() const | Gets the user-defined state object associated with the task. |
static get_CompletedTask() | Gets a completed task (singleton) |
static get_CurrentId() | |
get_Id() const | Gets the ID for task. |
get_IsCanceled() const | Gets whether the task completed due to cancellation. |
get_IsCompleted() const | Gets whether the task has completed. |
get_IsFaulted() const | Gets whether the task completed due to an unhandled exception. |
get_Scheduler() const | Gets the scheduler associated with this task. |
get_Status() const | Gets the current status of the task. |
GetAwaiter() const | Gets an awaiter for this task for use with Await. |
RunSynchronously() | Runs the task synchronously on the current thread. |
RunSynchronously(const SharedPtr<TaskScheduler>&) | Runs the task synchronously using the specified scheduler. |
set_Function(const FunctionT&) | Sets the internal function to execute. |
set_Status(TaskStatus) | Sets the task status. |
Start() | Starts the task execution using the default scheduler. |
Start(const SharedPtr<TaskScheduler>&) | Starts the task execution using the specified scheduler. |
Task(const Action<>&) | Constructs a Task with an action to execute. |
Task(const Action<>&, const CancellationToken&) | Constructs a Task with an action and cancellation token. |
Task(const Action<SharedPtr<Object>>&, const SharedPtr<Object>&) | Constructs a Task with a stateful action and state object. |
Task(const Action<SharedPtr<Object>>&, const SharedPtr<Object>&, const CancellationToken&) | Constructs a Task with stateful action, state, and cancellation token. |
Task() | Internal constructor for creating uninitialized tasks. |
Wait(const CancellationToken&) | Waits for the task to complete with cancellation support. |
Wait() | Waits for the task to complete. |
~Task() | Destructor. |
Typedefs
Typedef | Description |
---|---|
FunctionT | Internal implementation. Not for user code. |
Remarks
Provides a C++ implementation similar to System.Threading.Tasks.Task in .NET, supporting cancellation, continuations, and async/await patterns
See Also
- Class IDisposable
- Namespace System::Threading::Tasks
- Library Aspose.PDF for C++