/[LeafOK_CVS]/innwebd/thread_pool.h
ViewVC logotype

Diff of /innwebd/thread_pool.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 by sysadm, Sat Jul 3 09:37:58 2004 UTC Revision 1.4 by sysadm, Sat Jul 3 15:10:23 2004 UTC
# Line 19  Line 19 
19  #define TS_MAX_THREAD                   256  #define TS_MAX_THREAD                   256
20  #define TS_DEFAULT_TIMEOUT              10000  #define TS_DEFAULT_TIMEOUT              10000
21  #define TS_SETLOCK_TIMEOUT              100  #define TS_SETLOCK_TIMEOUT              100
 #define TS_SETLOCK_TIMEOUT_MAX  10000  
22    
23  class thread_pool  class thread_pool
24  {  {
# Line 44  private: Line 43  private:
43          HANDLE hThreadList[TS_MAX_THREAD];          HANDLE hThreadList[TS_MAX_THREAD];
44          thread_status uThreadStatusList[TS_MAX_THREAD];          thread_status uThreadStatusList[TS_MAX_THREAD];
45          clock_t time_status_set[TS_MAX_THREAD];          clock_t time_status_set[TS_MAX_THREAD];
46          clock_t thread_timeout;          clock_t thread_timeout[TS_MAX_THREAD];
47          bool bProcessLock;          bool bProcessLock;
48          int SetLock(bool bLock, clock_t tTimeout = TS_SETLOCK_TIMEOUT);          int SetLock(bool bLock, clock_t tTimeout = TS_SETLOCK_TIMEOUT);
49          error_code uLastErrorCode;          error_code uLastErrorCode;
50            HANDLE hThreadKiller;
51            bool bTerminateThreadKiller;
52  public:  public:
53          thread_pool(UINT uThreadMax = TS_MAX_THREAD, clock_t thread_timeout = TS_DEFAULT_TIMEOUT);          thread_pool(UINT uThreadMax = TS_MAX_THREAD);
54          ~thread_pool(void);          ~thread_pool(void);
55          int GetLastError(void);          static DWORD KillDeadThread(LPVOID pParam);
56          int AddThread(HANDLE hThread);          int GetLastError(void) const;
57            int AddThread(HANDLE hThread, clock_t thread_timeout = TS_DEFAULT_TIMEOUT);
58          int RemoveThread(HANDLE hThread);          int RemoveThread(HANDLE hThread);
59          int SetThreadStatus(HANDLE hThread, int uStatus);          int SetThreadStatus(HANDLE hThread, int uStatus);
60          int GetThreadStatus(HANDLE hThread);          int GetThreadStatus(HANDLE hThread);
61          int KillDeadThread(void);          int GetThreadCount(void) const;
62            int EnableKillDeadThread(void);
63            int DisableKillDeadThread(void);
64  };  };


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1