Fix a data race in the simulate_rf global variable.

This commit is contained in:
faluco 2021-09-15 10:57:18 +02:00 committed by faluco
parent c988fc49b4
commit 8d802e2aca
2 changed files with 6 additions and 6 deletions

View File

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

View File

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