diff --git a/include/EventLoop.h b/include/EventLoop.h index d9e6f68ef..e4cf7783b 100644 --- a/include/EventLoop.h +++ b/include/EventLoop.h @@ -111,7 +111,6 @@ class EventLoop : public TimeService inline void SetStopping(int code) { exitCode = code; - running = false; } /** diff --git a/src/EventLoop.cpp b/src/EventLoop.cpp index 7a038c0fa..19bd11378 100644 --- a/src/EventLoop.cpp +++ b/src/EventLoop.cpp @@ -505,7 +505,7 @@ void EventLoop::Run(const std::chrono::milliseconds &duration) auto until = duration < std::chrono::milliseconds::max() ? now + duration : std::chrono::milliseconds::max(); //Run until ended - while(running && now<=until) + while(running && !exitCode.has_value() && now<=until) { //TRACE_EVENT("eventloop", "EventLoop::Run::Iteration");