Blame view

src/Common/BaseThread.h 528 Bytes
e30d6793   Zou XiKun   v0.0.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  #ifndef BASE_THREAD_CLASS_H
  #define BASE_THREAD_CLASS_H
  
  #include <string>
  #include <pthread.h>
  #include "BaseEvent.h"
  
  class CBaseThread
  {
  public:
      CBaseThread();
      virtual ~CBaseThread();
  
      virtual int Run();
      BOOL BeginThread();
      void JoinThread();
  
  public:
      void Shutdown(BOOL bWatiForShutdown = TRUE);
  
  public:
      virtual BOOL InitInstance();
      virtual int ExitInstance();
  
  protected:
      BOOL IsStopping(DWORD nTimeOut = 10);
  
  protected:
      pthread_t m_thread;
      CBaseEvent m_StopEvent;
  
  };
  
  #endif