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

bugfix

parent 5c69dde6
Loading
Loading
Loading
Loading
+5 −1
Changes for src/event/epoll.cpp: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -797,7 +797,7 @@ namespace netplus {
    // runEventloop() after all threads have joined.
    // ------------------------------------------------------------
    static void signalHandler(int signum) {
        if (signum != SIGINT)
        if (signum != SIGINT && signum != SIGTERM)
            return;
        event::Running = false;
        // Wake up all epoll_wait calls so threads notice Running==false immediately.
@@ -885,6 +885,10 @@ namespace netplus {

    void event::runEventloop(ULONG_PTR args) {
        signal(SIGINT, signalHandler);
        // SIGTERM is what init systems and `docker stop` send: without it the
        // process died without returning from the loop, so no destructor ran
        // (buffered stores lost their unflushed writes).
        signal(SIGTERM, signalHandler);
        signal(SIGPIPE, SIG_IGN);

        // Create the global wakeup eventfd once per run.
+5 −1
Changes for src/event/kqueue.cpp: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -901,7 +901,7 @@ namespace netplus {
    // runEventloop() after all threads have joined.
    // ------------------------------------------------------------
    static void signalHandler(int signum) {
        if (signum != SIGINT)
        if (signum != SIGINT && signum != SIGTERM)
            return;
        event::Running = false;
        // Wake up all kevent() calls so threads notice Running==false immediately.
@@ -985,6 +985,10 @@ netplus::event::~event() {}

void netplus::event::runEventloop(ULONG_PTR args) {
    signal(SIGINT, netplus::signalHandler);
    // SIGTERM is what init systems and `docker stop` send: without it the
    // process died without returning from the loop, so no destructor ran
    // (buffered stores lost their unflushed writes).
    signal(SIGTERM, netplus::signalHandler);
    signal(SIGPIPE, SIG_IGN);

    // Create the global wakeup pipe once per run.
+5 −1
Changes for src/event/poll.cpp: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -725,7 +725,7 @@ namespace netplus {
    // ------------------------------------------------------------
    #ifndef _WIN32
    static void signalHandler(int signum) {
        if (signum != SIGINT)
        if (signum != SIGINT && signum != SIGTERM)
            return;
        event::Running = false;
    }
@@ -823,6 +823,10 @@ namespace netplus {
    void event::runEventloop(ULONG_PTR args) {
        #ifndef _WIN32
        signal(SIGINT, signalHandler);
        // SIGTERM is what init systems and `docker stop` send: without it the
        // process died without returning from the loop, so no destructor ran
        // (buffered stores lost their unflushed writes).
        signal(SIGTERM, signalHandler);
        signal(SIGPIPE, SIG_IGN);
        #endif