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

#include <UT_TaskState.h>

Public Types

enum  TaskStatus { FREE, BUSY, DONE }
 

Public Member Functions

 UT_TaskState ()
 
void reset ()
 
bool isDone () const
 Test whether the task state is marked as DONE. More...
 
TaskStatus tryMarkAsBusy ()
 
TaskStatus tryMarkAsBusyFromDone ()
 
void addWaitingTask (UT_Task &parent_task)
 
void markAsDone (UT_Task &parent_task)
 
void markAsDoneNoThread ()
 Non-threaded version of marking as done. More...
 
TaskStatus relaxedLoadStatus () const
 This does a fast (non-atomic) check of the status. More...
 

Detailed Description

Definition at line 37 of file UT_TaskState.h.

Member Enumeration Documentation

Enumerator
FREE 
BUSY 

Thread has acquired responsibility to evaluate node.

DONE 

Another thread is busy evaluating the node.

The node has been evaluated.

Definition at line 48 of file UT_TaskState.h.

Constructor & Destructor Documentation

UT_TaskState::UT_TaskState ( )
inline

Definition at line 55 of file UT_TaskState.h.

Member Function Documentation

void UT_TaskState::addWaitingTask ( UT_Task parent_task)
inline

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 103 of file UT_TaskState.h.

bool UT_TaskState::isDone ( ) const
inline

Test whether the task state is marked as DONE.

Definition at line 70 of file UT_TaskState.h.

void UT_TaskState::markAsDone ( UT_Task parent_task)
inline

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 137 of file UT_TaskState.h.

void UT_TaskState::markAsDoneNoThread ( )
inline

Non-threaded version of marking as done.

Definition at line 156 of file UT_TaskState.h.

TaskStatus UT_TaskState::relaxedLoadStatus ( ) const
inline

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

Definition at line 168 of file UT_TaskState.h.

void UT_TaskState::reset ( void  )
inline

Set the state to be "free" with no waiting tasks. This cannot be called from within threaded code.

Definition at line 63 of file UT_TaskState.h.

TaskStatus UT_TaskState::tryMarkAsBusy ( )
inline

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

Definition at line 78 of file UT_TaskState.h.

TaskStatus UT_TaskState::tryMarkAsBusyFromDone ( )
inline

Assuming that we're done, claim the node for the calling thread. Returns FREE if succeeded, BUSY if failed.

Definition at line 90 of file UT_TaskState.h.


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