Fix a data race in the simulate_rf global variable.

master
faluco 3 years ago committed by faluco
parent c988fc49b4
commit 8d802e2aca

@ -34,7 +34,7 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <unistd.h> #include <unistd.h>
extern bool simulate_rlf; extern std::atomic<bool> simulate_rlf;
using namespace std; using namespace std;
using namespace srsue; using namespace srsue;
@ -639,7 +639,7 @@ static void* input_loop(void*)
metrics_screen->toggle_print(do_metrics); metrics_screen->toggle_print(do_metrics);
} }
} else if (key == "rlf") { } else if (key == "rlf") {
simulate_rlf = true; simulate_rlf.store(true, std::memory_order_relaxed);
cout << "Sending Radio Link Failure" << endl; cout << "Sending Radio Link Failure" << endl;
} else if (key == "q") { } else if (key == "q") {
// let the signal handler do the job // let the signal handler do the job

@ -32,7 +32,7 @@
#include <numeric> #include <numeric>
#include <string.h> #include <string.h>
bool simulate_rlf = false; std::atomic<bool> simulate_rlf{false};
using namespace srsran; using namespace srsran;
using namespace asn1::rrc; using namespace asn1::rrc;
@ -203,9 +203,9 @@ void rrc::run_tti()
return; return;
} }
if (simulate_rlf) { if (simulate_rlf.load(std::memory_order_relaxed)) {
radio_link_failure_process(); radio_link_failure_process();
simulate_rlf = false; simulate_rlf.store(false, std::memory_order_relaxed);
} }
// Process pending PHY measurements in IDLE/CONNECTED // Process pending PHY measurements in IDLE/CONNECTED

Loading…
Cancel
Save