WorkerThread.h
上传用户:royluo
上传日期:2007-01-05
资源大小:1584k
文件大小:2k
源码类别:

游戏

开发平台:

Visual C++

  1. /*****************************************************************************
  2. *                                                                             
  3. *   WorkerThread.h
  4. *                                                                             
  5. *   Electrical Engineering Faculty - Software Lab                             
  6. *   Spring semester 1998                                                      
  7. *                                                                             
  8. *   Tanks game                                                                
  9. *                                                                             
  10. *   Module description: Interface for the worker thread base class.
  11. *                       
  12. *                                                                             
  13. *   Authors: Eran Yariv - 28484475                                           
  14. *            Moshe Zur  - 24070856                                           
  15. *                                                                            
  16. *                                                                            
  17. *   Date: 23/09/98                                                           
  18. *                                                                            
  19. ******************************************************************************/
  20. #ifndef _WORKER_THREAD_H
  21. #define _WORKER_THREAD_H
  22. class CWorkerThread
  23. {
  24. public:
  25.     CWorkerThread ();
  26.     virtual ~CWorkerThread ();
  27.     BOOL SetPriority (int prio);
  28. protected:
  29.     void StartWorkerThread (LPVOID pvParam = 0);
  30.     void EndWorkerThread (BOOL bWaitForTermination);
  31.     static UINT     InvokeThreadEntry (LPVOID pParam);  // Used as shell only, to invoke the thread
  32.     virtual UINT    ThreadEntry (LPVOID pParam = 0) = 0;
  33.     LPVOID          m_pvParam;               // Hold param for thread proc.
  34.     BOOL            m_bEndThread;            // Should the thread die? 
  35.     
  36. private:
  37.     HANDLE m_hThread;
  38.     BOOL   m_bThreadIsRunning;      // Is the thread running?
  39. };           
  40.         
  41. // Inline sections:
  42. #include <WorkerThread.inl>
  43. #endif