HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_Thread Class Referenceabstract

#include <UT_Thread.h>

+ Inheritance diagram for UT_Thread:

Public Types

enum  State { ThreadIdle, ThreadRunning }
 
enum  SpinMode { ThreadSingleRun, ThreadLowUsage }
 

Public Member Functions

virtual ~UT_Thread ()
 
virtual bool startThread (UTthreadFunc func, void *data, int stacksize)=0
 
bool startThread (UTthreadFunc func, void *data)
 
virtual void threadStarted ()
 
virtual void threadEnded ()
 
virtual int isResourceHog () const
 
virtual State getState ()
 
virtual SpinMode getSpinMode ()
 
virtual void waitForState (State desired)=0
 
virtual void setSpinMode (SpinMode spin_mode)
 
virtual void killThread ()=0
 
virtual int niceThread (int priority)=0
 
virtual int suspendThread ()=0
 
virtual int restartThread ()=0
 
int isActive ()
 
virtual int64 getMemoryUsage (bool inclusive) const =0
 NOTE: This level doesn't own any data apart from itself. More...
 

Static Public Member Functions

static UT_ThreadallocThread (SpinMode spin_mode)
 
static int getNumProcessors ()
 
static int activeThreadCount ()
 This is only valid in debug builds. More...
 
static void resetNumProcessors ()
 
static ut_thread_id_t getMyThreadId ()
 
static ut_thread_id_t getMainThreadId ()
 
static int getMainSequentialThreadId ()
 
static int isMainThread ()
 
static void pause (uint cycles)
 
static void yield (bool higher_only=false)
 
static int getMySequentialThreadIndex ()
 
static void configureMaxThreads (int maxthreads=-1, int stacksize=-1)
 
static bool isMaxThreadsConfigured ()
 
static void interval (int count, int thisSection, int numSections, int &start, int &len)
 

Protected Member Functions

virtual int waitThread (int block=1)=0
 
virtual int isValid ()
 
void killIdle ()
 
virtual void setState (State state)=0
 
 UT_Thread (SpinMode spin_mode)
 

Static Protected Member Functions

static voidthreadWrapper (void *data)
 

Protected Attributes

volatile State myState
 
SpinMode mySpinMode
 
UTthreadFunc myCallback
 
voidmyCBData
 
const UT_TaskScopemyTaskScope
 

Detailed Description

Definition at line 55 of file UT_Thread.h.

Member Enumeration Documentation

Enumerator
ThreadSingleRun 
ThreadLowUsage 

Definition at line 76 of file UT_Thread.h.

Enumerator
ThreadIdle 
ThreadRunning 

Definition at line 65 of file UT_Thread.h.

Constructor & Destructor Documentation

virtual UT_Thread::~UT_Thread ( )
virtual
UT_Thread::UT_Thread ( SpinMode  spin_mode)
protected

Member Function Documentation

static int UT_Thread::activeThreadCount ( )
static

This is only valid in debug builds.

static UT_Thread* UT_Thread::allocThread ( SpinMode  spin_mode)
static
static void UT_Thread::configureMaxThreads ( int  maxthreads = -1,
int  stacksize = -1 
)
static

Configure the global number of tasks used by the system and the default stack size for threads. For the stacksize:

  • A value of -1 leaves the stack size unchanged
  • A value of 0 uses the stack size of the main thread
  • A value larger than 0 will use that specific stack size
    Note
    Only call this in the main thread when there are no tasks active.
    This function is NOT thread-safe.
static int UT_Thread::getMainSequentialThreadId ( )
static
static ut_thread_id_t UT_Thread::getMainThreadId ( )
static
virtual int64 UT_Thread::getMemoryUsage ( bool  inclusive) const
pure virtual

NOTE: This level doesn't own any data apart from itself.

Implemented in UT_NullThread.

static int UT_Thread::getMySequentialThreadIndex ( )
inlinestatic

This function has been deprecated. Use SYS_SequentialThreadIndex::get() or SYSgetSTID instead.

Definition at line 142 of file UT_Thread.h.

static ut_thread_id_t UT_Thread::getMyThreadId ( )
static
Examples:
VEX/VEX_Ops.C.
static int UT_Thread::getNumProcessors ( )
static
virtual SpinMode UT_Thread::getSpinMode ( )
virtual
virtual State UT_Thread::getState ( )
virtual
static void UT_Thread::interval ( int  count,
int  thisSection,
int  numSections,
int start,
int len 
)
inlinestatic

Definition at line 200 of file UT_Thread.h.

int UT_Thread::isActive ( )
inline

Definition at line 197 of file UT_Thread.h.

static int UT_Thread::isMainThread ( )
inlinestatic

Definition at line 104 of file UT_Thread.h.

static bool UT_Thread::isMaxThreadsConfigured ( )
static
virtual int UT_Thread::isResourceHog ( ) const
virtual
virtual int UT_Thread::isValid ( )
protectedvirtual
void UT_Thread::killIdle ( )
protected
virtual void UT_Thread::killThread ( )
pure virtual

Implemented in UT_NullThread.

virtual int UT_Thread::niceThread ( int  priority)
pure virtual

Implemented in UT_NullThread.

static void UT_Thread::pause ( uint  cycles)
inlinestatic

Definition at line 110 of file UT_Thread.h.

static void UT_Thread::resetNumProcessors ( )
static

Reset the number of threads that is used by Houdini. This will reread the HOUDINI_MAXTHREADS setting.

Note
There should be no active tasks when this is called.
Only call this from the MAIN THREAD!
virtual int UT_Thread::restartThread ( )
pure virtual

Implemented in UT_NullThread.

virtual void UT_Thread::setSpinMode ( SpinMode  spin_mode)
virtual
virtual void UT_Thread::setState ( State  state)
protectedpure virtual

Implemented in UT_NullThread.

virtual bool UT_Thread::startThread ( UTthreadFunc  func,
void data,
int  stacksize 
)
pure virtual

Implemented in UT_NullThread.

bool UT_Thread::startThread ( UTthreadFunc  func,
void data 
)
virtual int UT_Thread::suspendThread ( )
pure virtual

Implemented in UT_NullThread.

virtual void UT_Thread::threadEnded ( )
virtual
virtual void UT_Thread::threadStarted ( )
virtual
static void* UT_Thread::threadWrapper ( void data)
staticprotected
virtual void UT_Thread::waitForState ( State  desired)
pure virtual

Implemented in UT_NullThread.

virtual int UT_Thread::waitThread ( int  block = 1)
protectedpure virtual

Implemented in UT_NullThread.

static void UT_Thread::yield ( bool  higher_only = false)
static

Member Data Documentation

UTthreadFunc UT_Thread::myCallback
protected

Definition at line 231 of file UT_Thread.h.

void* UT_Thread::myCBData
protected

Definition at line 232 of file UT_Thread.h.

SpinMode UT_Thread::mySpinMode
protected

Definition at line 230 of file UT_Thread.h.

volatile State UT_Thread::myState
protected

Definition at line 229 of file UT_Thread.h.

const UT_TaskScope* UT_Thread::myTaskScope
protected

Definition at line 234 of file UT_Thread.h.


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