OCC Main Page | FoundationClasses | Toolkits | Packages | Class Hierarchy | Data Structures | File List | Data Fields | Globals

FoundationClasses
TKernel
OSD


OSD_Thread Class Reference

A simple platform-intependent interface to execute
and control threads.
.

#include <OSD_Thread.hxx>


Public Member Functions

void * operator new (size_t, void *anAddress)
void * operator new (size_t size)
void operator delete (void *anAddress)
Standard_EXPORT OSD_Thread ()
 Empty constructor
.
Standard_EXPORT OSD_Thread (const OSD_ThreadFunction &func)
 Initialize the tool by the thread function
.
Standard_EXPORT OSD_Thread (const OSD_Thread &other)
 Copy constructor
.
Standard_EXPORT void Assign (const OSD_Thread &other)
 Copy thread handle from other OSD_Thread object.
.
void operator= (const OSD_Thread &other)
Standard_EXPORT void Destroy ()
 Destructor. On Windows, closes handle to the thread.
On UNIX/Linux, does nothing.
.
 ~OSD_Thread ()
Standard_EXPORT void SetPriority (const Standard_Integer thePriority)
Standard_EXPORT void SetFunction (const OSD_ThreadFunction &func)
 Initialize the tool by the thread function.
If the current thread handle is not null, nullifies it.
.
Standard_EXPORT Standard_Boolean Run (const Standard_Address data=0, const Standard_Integer WNTStackSize=0)
 Starts a thread with thread function given in constructor,
passing the specified input data (as void *) to it.
The parameter WNTStackSize (on Windows only)
specifies size of the stack to be allocated for the thread
(by default - the same as for the current executable).
Returns True if thread started successfully
.
Standard_EXPORT void Detach ()
 Detaches the execution thread from this Thread object,
so that it cannot be waited.
Note that mechanics of this operation is different on
UNIX/Linux (the thread is put to detached state) and Windows
(the handle is closed).
However, the purpose is the same: to instruct the system to
release all thread data upon its completion.
.
Standard_EXPORT Standard_Boolean Wait () const
Standard_EXPORT Standard_Boolean Wait (Standard_Address &result) const
 Wait till the thread finishes execution.
Returns True if wait was successful, False in case of error.
.
Standard_EXPORT Standard_ThreadId GetId () const
 Returns ID of the currently controlled thread ID,
or 0 if no thread is run
.

Static Public Member Functions

static Standard_EXPORT Standard_ThreadId Current ()
 Auxiliary: returns ID of the current thread
.

Private Attributes

OSD_ThreadFunction myFunc
OSD_PThread myThread
Standard_ThreadId myThreadId
Standard_Integer myPriority


Constructor & Destructor Documentation

Standard_EXPORT OSD_Thread::OSD_Thread  ) 
 

Standard_EXPORT OSD_Thread::OSD_Thread const OSD_ThreadFunction func  ) 
 

Standard_EXPORT OSD_Thread::OSD_Thread const OSD_Thread other  ) 
 

OSD_Thread::~OSD_Thread  )  [inline]
 


Member Function Documentation

Standard_EXPORT void OSD_Thread::Assign const OSD_Thread other  ) 
 

static Standard_EXPORT Standard_ThreadId OSD_Thread::Current  )  [static]
 

Standard_EXPORT void OSD_Thread::Destroy  ) 
 

Standard_EXPORT void OSD_Thread::Detach  ) 
 

Standard_EXPORT Standard_ThreadId OSD_Thread::GetId  )  const
 

void OSD_Thread::operator delete void *  anAddress  )  [inline]
 

void* OSD_Thread::operator new size_t  size  )  [inline]
 

void* OSD_Thread::operator new size_t  ,
void *  anAddress
[inline]
 

void OSD_Thread::operator= const OSD_Thread other  )  [inline]
 

Standard_EXPORT Standard_Boolean OSD_Thread::Run const Standard_Address  data = 0,
const Standard_Integer  WNTStackSize = 0
 

Standard_EXPORT void OSD_Thread::SetFunction const OSD_ThreadFunction func  ) 
 

Standard_EXPORT void OSD_Thread::SetPriority const Standard_Integer  thePriority  ) 
 

Standard_EXPORT Standard_Boolean OSD_Thread::Wait Standard_Address result  )  const
 

Standard_EXPORT Standard_Boolean OSD_Thread::Wait  )  const
 


Field Documentation

OSD_ThreadFunction OSD_Thread::myFunc [private]
 

Standard_Integer OSD_Thread::myPriority [private]
 

OSD_PThread OSD_Thread::myThread [private]
 

Standard_ThreadId OSD_Thread::myThreadId [private]
 


The documentation for this class was generated from the following file:
Generated on Mon Aug 25 13:13:11 2008 for OpenCASCADE by  doxygen 1.4.1