diff --git a/base/src/event_reactor.h b/base/src/event_reactor.h index 83139bdc6277a4153a068696ddcba0d504cc7d26..5ebd548aa5dea56ae34119a39f2450298ac1fd7b 100644 --- a/base/src/event_reactor.h +++ b/base/src/event_reactor.h @@ -16,6 +16,7 @@ #ifndef UTILS_EVENT_REACTOR_H #define UTILS_EVENT_REACTOR_H +#include #include #include #include @@ -69,7 +70,7 @@ public: private: mutable volatile bool loopReady_; // refers to whether reactor is ready to call RunLoop(). - volatile bool switch_; // a switch to enable while-loop in RunLoop(). true: start, false: stop. + std::atomic switch_; // a switch to enable while-loop in RunLoop(). true: start, false: stop. std::unique_ptr demultiplexer_; std::recursive_mutex mutex_; std::list> timerEventHandlers_;