Clarisse 4.0 SP9 SDK  4.0.0.0.9
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Protected Member Functions | Friends | List of all members
SysThread Class Referenceabstract

An operating system abstraction of a thread. Implement entry as entry point to the thread execution. More...

Inheritance diagram for SysThread:
CoreBaseObject CoreBaseType

Public Member Functions

 SysThread (const SysThread &src)
 
void set_affinity (const unsigned int *indices, const unsigned int &count)
 Set the CPUs on which the thread is allowed to be executed.
 
void create ()
 Create the thread in a suspend mode without running it.
 
void run (const unsigned int &group_index=0)
 run the thread procedure entry point. entry() call is imminent
 
void destroy ()
 Tell the thread to stop running, test_destroy() will then return true.
 
void kill ()
 Kill the current thread (forced destroy)
 
void wait_destruction ()
 
bool test_destroy () const
 Method to be used in the thread entry point entry() as an exit flag. If it returns true, the thread entry() implementation should stop running ASAP.
 
bool is_running () const
 Get if the thread is currently running.
 
bool is_alive () const
 Get if the thread is alive.
 
bool pause ()
 Pause the running thread.
 
bool resume ()
 Resume the paused thread.
 
bool is_paused () const
 Return is the thread is paused.
 
- Public Member Functions inherited from CoreBaseObject
bool is_kindof (const CoreBaseObject &object) const
 
virtual size_t get_memory_size () const
 
CoreString get_class_info_name () const
 
CoreString get_class_interface () const
 
const unsigned long & get_class_info_id () const
 
bool is_kindof (const CoreClassInfo &cinfo) const
 
virtual const CoreClassInfoget_class_info () const
 
bool operator== (const CoreBaseObject &obj) const
 
template<class T >
T * cast ()
 
template<class T >
const T * cast () const
 
- Public Member Functions inherited from CoreBaseType
bool is_kindof (const CoreClassInfo &cinfo) const
 
bool operator== (const CoreBaseType &obj) const
 

Protected Member Functions

virtual void entry ()=0
 execution entry point to overload to be called by the thread
 

Friends

class SysThreadImpl
 

Additional Inherited Members

- Static Public Member Functions inherited from CoreBaseObject
static const CoreClassInfoclass_info ()
 
static bool ___class_destructor__ (void *instance, const bool &is_array)
 
template<class T >
static T * cast (CoreBaseObject *object)
 
template<class T >
static const T * cast (const CoreBaseObject *object)
 

Detailed Description

An operating system abstraction of a thread. Implement entry as entry point to the thread execution.

Member Function Documentation

bool SysThread::is_alive ( ) const

Get if the thread is alive.

Returns
true if the thread is alive
bool SysThread::is_running ( ) const

Get if the thread is currently running.

Returns
true if the thread is currently running
void SysThread::kill ( )

Kill the current thread (forced destroy)

Note
On Windows platform variables created inside Entry() won't be released from the heap! Use this method with extreme caution. Note also, that a Kill() call won't affect the destructor of the SysThread, so all the class member variables will be properly cleaned. If you really need to use Kill(), it is then wise to create all your variables outside the Entry() entry point.
void SysThread::set_affinity ( const unsigned int *  indices,
const unsigned int &  count 
)

Set the CPUs on which the thread is allowed to be executed.

Parameters
indicesthe IDs of the CPUs
bool SysThread::test_destroy ( ) const

Method to be used in the thread entry point entry() as an exit flag. If it returns true, the thread entry() implementation should stop running ASAP.

Returns
true if the thread has to stop