/[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.4 by sysadm, Sat Jul 3 15:10:23 2004 UTC Revision 1.5 by sysadm, Sun Jul 4 06:45:23 2004 UTC
# Line 1  Line 1 
1  /*******************************************************/  /*******************************************************/
2  /*                                                     */  /*                                                     */
3  /*  LeafOK Innd                                        */  /*  LeafOK Innbbsd                                     */
4  /*  Copyright (C) LeafOK.com, 2003-2004                */  /*  Copyright (C) LeafOK.com, 2003-2004                */
5  /*                                                     */  /*                                                     */
6  /*  Programmed by Leaf                                 */  /*  Programmed by Leaf                                 */
7  /*  E-mail:leaf@leafok.com  QQ:6049044                 */  /*  E-mail:leaflet@leafok.com  QQ:6049044              */
8  /*                                                     */  /*                                                     */
9  /*  http://bbs.leafok.com                              */  /*  http://bbs.leafok.com                              */
10  /*  http://bbs.leafok.net                              */  /*  http://bbs.leafok.net                              */
# Line 35  public: Line 35  public:
35                  E_MAX_THREAD_EXCEEDED   =       2,                  E_MAX_THREAD_EXCEEDED   =       2,
36                  E_THREAD_NOT_FOUND              =       3,                  E_THREAD_NOT_FOUND              =       3,
37                  E_INVALID_TIMEOUT               =       4,                  E_INVALID_TIMEOUT               =       4,
38                  E_KILL_THREAD_FAILED    =       5                  E_KILL_THREAD_FAILED    =       5,
39                    E_KILLER_BEGIN_FAILED   =       6,
40                    E_KILLER_END_FAILED             =       7,
41                    E_INVALID_THREAD                =       8
42          };          };
43  private:  private:
44          UINT uThreadCount;          UINT uThreadCount;
45          UINT uThreadMax;          UINT uThreadMax;
46          HANDLE hThreadList[TS_MAX_THREAD];          ULONG ulThreadIdList[TS_MAX_THREAD];
47          thread_status uThreadStatusList[TS_MAX_THREAD];          thread_status uThreadStatusList[TS_MAX_THREAD];
48          clock_t time_status_set[TS_MAX_THREAD];          clock_t time_status_set[TS_MAX_THREAD];
49          clock_t thread_timeout[TS_MAX_THREAD];          clock_t thread_timeout[TS_MAX_THREAD];
50          bool bProcessLock;          bool bProcessLock;
51          int SetLock(bool bLock, clock_t tTimeout = TS_SETLOCK_TIMEOUT);          int SetLock(bool bLock, clock_t tTimeout = TS_SETLOCK_TIMEOUT);
52          error_code uLastErrorCode;          error_code uLastErrorCode;
53          HANDLE hThreadKiller;          ULONG ulThreadKillerId;
54          bool bTerminateThreadKiller;          bool bTerminateThreadKiller;
55  public:  public:
56          thread_pool(UINT uThreadMax = TS_MAX_THREAD);          thread_pool(UINT uThreadMax = TS_MAX_THREAD);
57          ~thread_pool(void);          ~thread_pool(void);
58          static DWORD KillDeadThread(LPVOID pParam);          static DWORD KillDeadThread(LPVOID pParam);
59          int GetLastError(void) const;          int GetLastError(void) const;
60          int AddThread(HANDLE hThread, clock_t thread_timeout = TS_DEFAULT_TIMEOUT);          int AddThread(ULONG ulThreadId, clock_t thread_timeout = TS_DEFAULT_TIMEOUT);
61          int RemoveThread(HANDLE hThread);          int RemoveThread(ULONG ulThreadId);
62          int SetThreadStatus(HANDLE hThread, int uStatus);          int SetThreadStatus(ULONG ulThreadId, int uStatus);
63          int GetThreadStatus(HANDLE hThread);          int GetThreadStatus(ULONG ulThreadId);
64          int GetThreadCount(void) const;          int GetThreadCount(void) const;
65          int EnableKillDeadThread(void);          int EnableKillDeadThread(void);
66          int DisableKillDeadThread(void);          int DisableKillDeadThread(void);
67            int KillAllThread(void);
68  };  };


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

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