HDK
|
A task node for managing which thread is currently working on a given task. More...
#include <UT_TaskState.h>
Public Types | |
enum | TaskStatus { FREE, BUSY_WITH_ARENA, BUSY_NO_ARENA, DONE_WITH_ARENA, DONE_NO_ARENA } |
using | ArenaAndGroup = std::pair< UT_TaskArena, UT_TaskGroup > |
Public Member Functions | |
UT_TaskState () | |
~UT_TaskState () | |
void | reset () |
bool | isDone () const |
Test whether the task state is marked as DONE. More... | |
TaskStatus | tryMarkAsBusy (bool run_in_task_arena=false) |
TaskStatus | tryMarkAsBusyFromDone () |
void | addWaitingTask (UT_Task &parent_task) |
void | markAsDone (UT_Task *parent_task, bool run_in_task_arena) |
void | markAsDoneNoThread () |
Non-threaded version of marking as done. More... | |
TaskStatus | relaxedLoadStatus () const |
This does a fast (non-atomic) check of the status. More... | |
void | setAndRetainArenaGroup (ArenaAndGroup *p) |
ArenaAndGroup * | getArenaGroup () const |
void | decrefArenaGroup () |
A task node for managing which thread is currently working on a given task.
Definition at line 47 of file UT_TaskState.h.
using UT_TaskState::ArenaAndGroup = std::pair<UT_TaskArena,UT_TaskGroup> |
Definition at line 230 of file UT_TaskState.h.
Enumerator | |
---|---|
FREE | |
BUSY_WITH_ARENA |
Thread has acquired responsibility to evaluate node. |
BUSY_NO_ARENA |
Another thread is busy evaluating the node with an arena. |
DONE_WITH_ARENA |
Another thread is busy evaluating the node without an arena. |
DONE_NO_ARENA |
The node has been evaluated with an arena. The node has been evaluated without an arena. |
Definition at line 58 of file UT_TaskState.h.
|
inline |
Definition at line 67 of file UT_TaskState.h.
|
inline |
Definition at line 76 of file UT_TaskState.h.
Assuming that we're busy, add a waiting task to be spawned when we're free again. This is done a lock-free linked-list style.
Definition at line 153 of file UT_TaskState.h.
|
inline |
Decrements the reference count for myArenaAndGroup and deletes it if the reference count reaches zero.
Definition at line 246 of file UT_TaskState.h.
|
inline |
Definition at line 238 of file UT_TaskState.h.
|
inline |
Test whether the task state is marked as DONE.
Definition at line 96 of file UT_TaskState.h.
Mark this node as being free. We walk through our waiting tasks and spawn them. Since the proxy tasks are just empty tasks, they will complete immediately and decrement the ref count of their parent task. If the ref count of the parent task goes down to 0, then it will then be runnable in the task scheduler.
Definition at line 187 of file UT_TaskState.h.
|
inline |
Non-threaded version of marking as done.
Definition at line 213 of file UT_TaskState.h.
|
inline |
This does a fast (non-atomic) check of the status.
Definition at line 225 of file UT_TaskState.h.
Set the state to be "free" with no waiting tasks. This cannot be called from within threaded code.
Definition at line 85 of file UT_TaskState.h.
|
inline |
Definition at line 232 of file UT_TaskState.h.
|
inline |
Attempt to claim this node for the calling thread, returning the current status.
Definition at line 105 of file UT_TaskState.h.
|
inline |
Assuming that we're done, claim the node for the calling thread. Returns FREE if succeeded, BUSY if failed.
Definition at line 134 of file UT_TaskState.h.
SYS_AtomicPtr<ArenaAndGroup> UT_TaskState::myArenaAndGroup |
Definition at line 264 of file UT_TaskState.h.
SYS_AtomicPtr<UT_TaskStateProxy> UT_TaskState::myWaitingTasks |
Definition at line 265 of file UT_TaskState.h.