--- innwebd/base.h 2004/07/02 11:22:00 1.1 +++ innwebd/base.h 2004/08/28 15:38:42 1.6 @@ -1,10 +1,10 @@ /*******************************************************/ /* */ -/* LeafOK Innd */ +/* LeafOK Innbbsd */ /* Copyright (C) LeafOK.com, 2003-2004 */ /* */ /* 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 */ @@ -16,6 +16,7 @@ #include "afxdb.h" #include "winsock2.h" +#include ".\thread_pool.h" class base { @@ -25,8 +26,30 @@ public: virtual void configure(const char* innd_id, const char* innd_name, const char* innd_server, unsigned long innd_uid, const char* w_address, unsigned int w_port, const char* w_conn_str); int begin(void); int end(void); - bool IsRunning(void); + inline bool IsRunning(void) + { + return (this->running && this->IsThreadActive()); + } + inline base* GetParentThread(void) + { + return this->p_ParentThread; + } + inline void SetParentThread(base* p_ParentThread) + { + this->p_ParentThread = p_ParentThread; + } + inline thread_pool* GetThreadPool(void) + { + return this->p_ThreadPool; + } + inline void SetThreadPool(thread_pool* p_ThreadPool) + { + this->p_ThreadPool = p_ThreadPool; + } protected: + ULONG ulMainThreadId; + base* p_ParentThread; + thread_pool* p_ThreadPool; SOCKET s; SOCKADDR sockaddr; CDatabase Db; @@ -50,14 +73,15 @@ protected: virtual int s_connect(const char* hostname, unsigned int port) = 0; virtual int s_close(void) = 0; int s_send(const char* in_str, bool auto_endl = true); - int s_receive(CString& out_str, const char* end_str="\r\n"); - int s_exec(const char* in_str, CString& out_str, const char* end_str="\r\n"); + int s_receive(CString& out_str, char end_str[] = "\r"); + int s_exec(const char* in_str, CString& out_str, char end_str[] = "\r"); virtual bool IsShutdown(void); virtual int Shutdown(void); virtual int Startup(void); virtual int w_call() = 0; private: - HANDLE hThread; static DWORD Thread(LPVOID pParam); +public: + bool IsThreadActive(void); };