Commit aae73952 authored by jan.koester's avatar jan.koester
Browse files

tets

parent 96cdcffc
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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"
@@ -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);

@@ -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
                }
            }
        }