#ifndef HGL_NETWORK_MULTI_THREAD_ACCEPT_INCLUDE #define HGL_NETWORK_MULTI_THREAD_ACCEPT_INCLUDE #include #include #include namespace hgl { namespace network { class IPAddress; class AcceptServer; using IPAddressStack=Stack; /** * Socket接入线程 */ class AcceptThread:public Thread { AcceptServer *server; Semaphore *active_semaphore; protected: IPAddressStack ip_stack; /// class MultiThreadAccept { MultiThreadManage accept_thread_manage; Semaphore active_semaphore; public: virtual ~MultiThreadAccept()=default; bool Init(AcceptServer *server,const uint thread_count) { if(!server)return(false); if(thread_count<=0)return(false); for(int i=0;i0;} int IsLive (){return accept_thread_manage.IsLive();} bool Close (){return accept_thread_manage.Close();} /** * 等待接收信号 */ bool Wait(const double &time_over=5) { return active_semaphore.Acquire(time_over); } };//template class MultiThreadAccept }//namespace network }//namespace hgl #endif//HGL_NETWORK_MULTI_THREAD_ACCEPT_INCLUDE