All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_TaskState Class Reference

A task node for managing which thread is currently working on a given task. More...

#include <UT_TaskState.h>

Public Types

enum  TaskStatus {
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)
ArenaAndGroupgetArenaGroup () const
void decrefArenaGroup ()

Detailed Description

A task node for managing which thread is currently working on a given task.

Definition at line 47 of file UT_TaskState.h.

Member Typedef Documentation

Definition at line 230 of file UT_TaskState.h.

Member Enumeration Documentation


Thread has acquired responsibility to evaluate node.


Another thread is busy evaluating the node with an arena.


Another thread is busy evaluating the node without an 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.

Constructor & Destructor Documentation

UT_TaskState::UT_TaskState ( )

Definition at line 67 of file UT_TaskState.h.

UT_TaskState::~UT_TaskState ( )

Definition at line 76 of file UT_TaskState.h.

Member Function Documentation

void UT_TaskState::addWaitingTask ( UT_Task parent_task)

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.

void UT_TaskState::decrefArenaGroup ( )

Decrements the reference count for myArenaAndGroup and deletes it if the reference count reaches zero.

Definition at line 246 of file UT_TaskState.h.

ArenaAndGroup* UT_TaskState::getArenaGroup ( ) const

Definition at line 238 of file UT_TaskState.h.

bool UT_TaskState::isDone ( ) const

Test whether the task state is marked as DONE.

Definition at line 96 of file UT_TaskState.h.

void UT_TaskState::markAsDone ( UT_Task parent_task,
bool  run_in_task_arena 

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.

void UT_TaskState::markAsDoneNoThread ( )

Non-threaded version of marking as done.

Definition at line 213 of file UT_TaskState.h.

TaskStatus UT_TaskState::relaxedLoadStatus ( ) const

This does a fast (non-atomic) check of the status.

Definition at line 225 of file UT_TaskState.h.

void UT_TaskState::reset ( void  )

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.

void UT_TaskState::setAndRetainArenaGroup ( ArenaAndGroup p)

Definition at line 232 of file UT_TaskState.h.

TaskStatus UT_TaskState::tryMarkAsBusy ( bool  run_in_task_arena = false)

Attempt to claim this node for the calling thread, returning the current status.

Definition at line 105 of file UT_TaskState.h.

TaskStatus UT_TaskState::tryMarkAsBusyFromDone ( )

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.

Member Data Documentation

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.

The documentation for this class was generated from the following file: