Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

CascadeThread.h

Go to the documentation of this file.
00001 //
00002 // CascadeThread.h - header file for class CascadeThread
00003 //
00004 // Copyright (c) 2002, Roku, LLC.  All rights reserved.
00005 //
00008 
00009 #ifndef _ROKU_INCLUDE_CASCADE_INTERTHREAD_CASCADETHREAD_H
00010 #define _ROKU_INCLUDE_CASCADE_INTERTHREAD_CASCADETHREAD_H
00011 
00012 #include <cascade/CascadeObject.h>
00013 
00024 class CascadeThread : public CascadeObject
00025 {
00026 protected:
00027     virtual void ThreadProc() = 0;
00033 
00034 public:
00035     // construction
00036         CascadeThread();  
00040         virtual ~CascadeThread();
00052             
00053 public:
00054     // simple thread control
00055     bool Start(bool bDetached = false);
00083     bool WaitUntilFinished();
00097     bool Detach();
00109 public:
00110     // general thread utility functions
00111     static void Sleep(u32 nMilliseconds);
00117     static u32 GetCurrentThreadID();
00123     u32 GetThreadID();
00128      void SetName(const char * pName);
00136      void GetName(char * pBuff, u32 nBuffLen);
00143 
00144 public:
00145     // advanced functions dealing with real time thread priorities
00146     // (only available to processes with superuser priviliges)
00147     bool SetRealtimePriority(int nPriority);
00167     bool GetRealtimePriority(int & nRealtimePriorityToSet);
00177     bool SetNonRealtime();
00184     inline bool IsRealtimeThread() { int prio = 0; return GetRealtimePriority(prio); }
00186 
00192     static void GetValidRealtimePriorityRange(int & lowest, int & highest);
00202     static bool IsValidRealtimePriority(int nPriority);
00211 private:
00212     class Thread; friend class Thread;
00213     Thread * m_pThread;
00214 
00215     #ifndef DOXY_SKIP
00216         // TEMP
00217         static void TagPrint(const char * pMessage);
00218             // TagPrint will printf pMessage to stdout, prefaced
00219             // with the pthread_id of the thread.
00220     #endif        
00221 };
00222 
00223 #endif // #ifndef _ROKU_INCLUDE_CASCADE_INTERTHREAD_CASCADETHREAD_H
00224 
00226 //  LOG
00228 //  20-Dec-02   dwoodward       created
00229 //  20-Jan-03   dwoodward       1.0 STATUS: 100% complete
00230 //  05-May-03   dwoodward   doxygenated
00231 //  15-Mar-04   dwoodward   use private nested forward declared class instead of void *
00232 //                          for private impl; added GetCurrentThreadID(), GetThreadID(),
00233 //                          SetName(), GetName()
00234 //  26-Apr-05   dwoodward   added Detach()

Generated on Sun Jul 24 14:27:17 2005 for Cascade Library by  doxygen 1.4.1