Loading src/event/kqueue.cpp +18 −2 Changes for src/event/kqueue.cpp: 18 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -54,6 +54,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define BLOCKSIZE 16384 namespace netplus { bool RUNNING=true; void signalHandler(int signum) { switch(signum){ case SIGINT: RUNNING=false; break; default: break; } } class pollapi { public: pollapi(eventapi *eapi,int timeout){ Loading Loading @@ -143,7 +155,10 @@ namespace netplus { } int waitEventHandler() { int evn = kevent(_pollFD,nullptr,0,_Events,_ServerSocket->getMaxconnections(),nullptr); struct timespec ts; ts.tv_nsec=_Timeout; int evn = kevent(_pollFD,nullptr,0,_Events,_ServerSocket->getMaxconnections(),ts); if (evn < 0 ) { NetException exception; Loading Loading @@ -338,7 +353,7 @@ namespace netplus { EventWorker(int tid,ULONG_PTR args,EventWorkerArgs* eargs) { poll pollptr(eargs->ssocket,eargs->event,eargs->pollfd,eargs->timeout); for(;;){ while(RUNNING){ try { int wait=pollptr.waitEventHandler(); for(int i =0; i<wait; ++i){ Loading Loading @@ -420,6 +435,7 @@ namespace netplus { NetException exception; signal(SIGPIPE, SIG_IGN); signal(SIGINT, signalHandler); _pollFD = kqueue(); Loading Loading
src/event/kqueue.cpp +18 −2 Changes for src/event/kqueue.cpp: 18 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -54,6 +54,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define BLOCKSIZE 16384 namespace netplus { bool RUNNING=true; void signalHandler(int signum) { switch(signum){ case SIGINT: RUNNING=false; break; default: break; } } class pollapi { public: pollapi(eventapi *eapi,int timeout){ Loading Loading @@ -143,7 +155,10 @@ namespace netplus { } int waitEventHandler() { int evn = kevent(_pollFD,nullptr,0,_Events,_ServerSocket->getMaxconnections(),nullptr); struct timespec ts; ts.tv_nsec=_Timeout; int evn = kevent(_pollFD,nullptr,0,_Events,_ServerSocket->getMaxconnections(),ts); if (evn < 0 ) { NetException exception; Loading Loading @@ -338,7 +353,7 @@ namespace netplus { EventWorker(int tid,ULONG_PTR args,EventWorkerArgs* eargs) { poll pollptr(eargs->ssocket,eargs->event,eargs->pollfd,eargs->timeout); for(;;){ while(RUNNING){ try { int wait=pollptr.waitEventHandler(); for(int i =0; i<wait; ++i){ Loading Loading @@ -420,6 +435,7 @@ namespace netplus { NetException exception; signal(SIGPIPE, SIG_IGN); signal(SIGINT, signalHandler); _pollFD = kqueue(); Loading