Provides information about the status of the currently running Task.
More...
#include <task_context.h>
Provides information about the status of the currently running Task.
embb::mtapi::TaskContext::TaskContext |
( |
mtapi_task_context_t * |
task_context | ) |
|
|
explicit |
Constructs a TaskContext from the given C representation.
- Concurrency
- Thread-safe and wait-free
- Parameters
-
task_context | The C task context to wrap. |
bool embb::mtapi::TaskContext::ShouldCancel |
( |
| ) |
|
Queries whether the Task running in the TaskContext should finish.
- Returns
true
if the Task should finish, otherwise false
- Concurrency
- Not thread-safe
mtapi_task_state_t embb::mtapi::TaskContext::GetTaskState |
( |
| ) |
|
Queries the current Task state.
- Returns
- The current Task state.
- Concurrency
- Not thread-safe
mtapi_uint_t embb::mtapi::TaskContext::GetCurrentWorkerNumber |
( |
| ) |
|
Queries the index of the worker thread the Task is running on.
- Returns
- The worker thread index the Task is running on
- Concurrency
- Not thread-safe
mtapi_uint_t embb::mtapi::TaskContext::GetInstanceNumber |
( |
| ) |
|
Queries the current instance of the currently executing Task.
- Returns
- The current instance number
- Concurrency
- Not thread-safe
mtapi_uint_t embb::mtapi::TaskContext::GetNumberOfInstances |
( |
| ) |
|
Queries the number of instances of the currently executing Task.
- Returns
- The number of instances
- Concurrency
- Not thread-safe
void embb::mtapi::TaskContext::SetStatus |
( |
mtapi_status_t |
error_code | ) |
|
Sets the return status of the running Task.
This will be returned by Task::Wait() and is set to MTAPI_SUCCESS
by default.
- Concurrency
- Not thread-safe
- Parameters
-
mtapi_task_context_t* embb::mtapi::TaskContext::GetInternal |
( |
| ) |
const |
Returns the internal representation of this object.
Allows for interoperability with the C interface.
- Returns
- A pointer to a mtapi_task_context_t.
- Concurrency
- Not thread-safe