CThread.hpp

Go to the documentation of this file.
00001 #ifndef __CThread__
00002 #define __CThread__
00003 
00004 #include "IThread.hpp"
00005 #include "CCriticalSectionScope.hpp"
00006 using Exponent::Threading::CCriticalSectionScope;
00007 using Exponent::Threading::IThread;
00008 
00009 //  ===========================================================================
00010 
00011 namespace Exponent
00012 {
00013     namespace Threading
00014     {
00032         class CThread : public IThread, public CCountedObject
00033         {
00035             EXPONENT_CLASS_DECLARATION;
00038 //  ===========================================================================
00039 
00040         public:
00041 
00045             CThread();
00046 
00050             virtual ~CThread();
00051 
00052 //  ===========================================================================
00053 
00062             virtual bool runThread();
00063 
00068             virtual void stopThread();
00069 
00074             virtual bool isThreadActive() const;
00075 
00076 //  ===========================================================================
00077               
00082             virtual void registerThreadListener(IThreadListener *listener);
00083 
00088             virtual IThreadListener *getThreadListener();
00089 
00090 //  ===========================================================================
00091 
00096             virtual void setThreadPriority(const IThread::EThreadPriority priority);
00097 
00102             virtual IThread::EThreadPriority getThreadPriority() const;
00103 
00104 //  ===========================================================================
00105 
00110             void sleepThread(const long timeInMilliseconds);
00111 
00112 //  ===========================================================================
00113 
00118             virtual void setThreadHandle(IThread::SThreadHandle *threadHandle);
00119 
00124             virtual IThread::SThreadHandle *getThreadHandle();
00125 
00126 //  ===========================================================================
00127 
00132             virtual void setCriticalSection(CCriticalSection *criticalSection);
00133 
00134 //  ===========================================================================
00135 
00136         protected:
00137 
00138 //  ===========================================================================
00139 
00145             void endThread();
00146 
00147 //  ===========================================================================
00148 
00149             EThreadPriority m_priority;                         
00150             IThreadListener *m_threadListener;                  
00151             bool m_threadIsActive;                              
00152             IThread::SThreadHandle *m_threadHandle;             
00153             CCriticalSection *m_threadCriticalSection;          
00154             CCriticalSectionScope m_criticalSectionScope;       
00155         };
00156     }
00157 }
00158 
00159 #endif      // End of CThread.hpp

Infinity API - CThread.hpp Source File generated on 7 Mar 2007