diff --git a/lib/include/srsran/common/epoll_helper.h b/lib/include/srsran/common/epoll_helper.h index 6382b08a8..e5955334d 100644 --- a/lib/include/srsran/common/epoll_helper.h +++ b/lib/include/srsran/common/epoll_helper.h @@ -17,6 +17,7 @@ #ifndef SRSRAN_EPOLL_HELPER_H #define SRSRAN_EPOLL_HELPER_H +#include #include #include #include @@ -58,7 +59,7 @@ private: class epoll_signal_handler : public epoll_handler { public: - epoll_signal_handler(bool* running_) : running(running_) {} + epoll_signal_handler(std::atomic& running_) : running(running_) {} int handle_event(int fd, epoll_event e, int epoll_fd) { @@ -72,7 +73,7 @@ public: case SIGINT: case SIGHUP: case SIGQUIT: - *running = false; + running = false; break; default: fprintf(stderr, "got signal %d\n", info.ssi_signo); @@ -82,7 +83,7 @@ public: } private: - bool* running = nullptr; + std::atomic& running; }; ///< Create periodic epoll timer every 1ms diff --git a/srsue/test/ttcn3/hdr/ttcn3_syssim.h b/srsue/test/ttcn3/hdr/ttcn3_syssim.h index 14fe4e76a..827563841 100644 --- a/srsue/test/ttcn3/hdr/ttcn3_syssim.h +++ b/srsue/test/ttcn3/hdr/ttcn3_syssim.h @@ -25,6 +25,7 @@ #include "ttcn3_sys_interface.h" #include "ttcn3_ue.h" #include "ttcn3_ut_interface.h" +#include #include class ttcn3_syssim : public syssim_interface_phy, @@ -223,8 +224,8 @@ private: all_args_t args = {}; // Simulator vars - ttcn3_ue* ue = nullptr; - bool running = false; + ttcn3_ue* ue = nullptr; + std::atomic running = {false}; typedef enum { UE_SWITCH_ON = 0, UE_SWITCH_OFF, ENABLE_DATA, DISABLE_DATA } ss_events_t; block_queue event_queue; diff --git a/srsue/test/ttcn3/src/ttcn3_syssim.cc b/srsue/test/ttcn3/src/ttcn3_syssim.cc index 4472d5d47..8978e861b 100644 --- a/srsue/test/ttcn3/src/ttcn3_syssim.cc +++ b/srsue/test/ttcn3/src/ttcn3_syssim.cc @@ -49,7 +49,7 @@ ttcn3_syssim::ttcn3_syssim(ttcn3_ue* ue_) : mac_msg_dl(20, ss_mac_logger), pdus(logger), ue(ue_), - signal_handler(&running), + signal_handler(running), timer_handler(create_tti_timer(), [&](uint64_t res) { new_tti_indication(res); }) { if (ue->init(all_args_t{}, this, "INIT_TEST") != SRSRAN_SUCCESS) {