--- innwebd/thread_pool.h 2004/07/03 15:10:23 1.4 +++ innwebd/thread_pool.h 2005/02/26 16:10:26 1.6 @@ -1,10 +1,10 @@ /*******************************************************/ /* */ -/* LeafOK Innd */ -/* Copyright (C) LeafOK.com, 2003-2004 */ +/* LeafOK Innbbsd */ +/* Copyright (C) LeafOK.com, 2003-2005 */ /* */ /* Programmed by Leaf */ -/* E-mail:leaf@leafok.com QQ:6049044 */ +/* E-mail:leaflet@leafok.com QQ:6049044 */ /* */ /* http://bbs.leafok.com */ /* http://bbs.leafok.net */ @@ -35,30 +35,34 @@ public: E_MAX_THREAD_EXCEEDED = 2, E_THREAD_NOT_FOUND = 3, E_INVALID_TIMEOUT = 4, - E_KILL_THREAD_FAILED = 5 + E_KILL_THREAD_FAILED = 5, + E_KILLER_BEGIN_FAILED = 6, + E_KILLER_END_FAILED = 7, + E_INVALID_THREAD = 8 }; private: UINT uThreadCount; UINT uThreadMax; - HANDLE hThreadList[TS_MAX_THREAD]; + ULONG ulThreadIdList[TS_MAX_THREAD]; thread_status uThreadStatusList[TS_MAX_THREAD]; clock_t time_status_set[TS_MAX_THREAD]; clock_t thread_timeout[TS_MAX_THREAD]; bool bProcessLock; int SetLock(bool bLock, clock_t tTimeout = TS_SETLOCK_TIMEOUT); error_code uLastErrorCode; - HANDLE hThreadKiller; + ULONG ulThreadKillerId; bool bTerminateThreadKiller; public: thread_pool(UINT uThreadMax = TS_MAX_THREAD); ~thread_pool(void); static DWORD KillDeadThread(LPVOID pParam); int GetLastError(void) const; - int AddThread(HANDLE hThread, clock_t thread_timeout = TS_DEFAULT_TIMEOUT); - int RemoveThread(HANDLE hThread); - int SetThreadStatus(HANDLE hThread, int uStatus); - int GetThreadStatus(HANDLE hThread); + int AddThread(ULONG ulThreadId, clock_t thread_timeout = TS_DEFAULT_TIMEOUT); + int RemoveThread(ULONG ulThreadId); + int SetThreadStatus(ULONG ulThreadId, int uStatus); + int GetThreadStatus(ULONG ulThreadId); int GetThreadCount(void) const; int EnableKillDeadThread(void); int DisableKillDeadThread(void); + int KillAllThread(void); };