Loading src/event/epoll.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <sys/epoll.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> #include <cstring> #include "config.h" Loading Loading @@ -534,6 +535,12 @@ namespace netplus { try { int wait = pollptr.waitEventHandler(eargs->timeout); if (wait == 0) { // No events, brief sleep to reduce CPU usage usleep(1000); // 1ms continue; } for (int i = 0; i < wait; ++i) { int evtype = pollptr.pollState(i); Loading @@ -550,6 +557,7 @@ namespace netplus { } catch (NetException& e) { std::cerr << "Poll Error: " << e.what() << std::endl; usleep(10000); // 10ms sleep on error to reduce CPU thrashing } } } Loading Loading
src/event/epoll.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <sys/epoll.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> #include <cstring> #include "config.h" Loading Loading @@ -534,6 +535,12 @@ namespace netplus { try { int wait = pollptr.waitEventHandler(eargs->timeout); if (wait == 0) { // No events, brief sleep to reduce CPU usage usleep(1000); // 1ms continue; } for (int i = 0; i < wait; ++i) { int evtype = pollptr.pollState(i); Loading @@ -550,6 +557,7 @@ namespace netplus { } catch (NetException& e) { std::cerr << "Poll Error: " << e.what() << std::endl; usleep(10000); // 10ms sleep on error to reduce CPU thrashing } } } Loading