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
@ -2779,7 +2779,7 @@ void rrc::release_drb(uint32_t drb_id)
*/ */
uint32_t rrc::get_lcid_for_drb_id(const uint32_t& drb_id) uint32_t rrc::get_lcid_for_drb_id(const uint32_t& drb_id)
{ {
uint32_t lcid = 0; uint32_t lcid = 0;
if (drbs.find(drb_id) != drbs.end()) { if (drbs.find(drb_id) != drbs.end()) {
asn1::rrc::drb_to_add_mod_s drb_cnfg = drbs[drb_id]; asn1::rrc::drb_to_add_mod_s drb_cnfg = drbs[drb_id];
if (drb_cnfg.lc_ch_id_present) { if (drb_cnfg.lc_ch_id_present) {

Loading…
Cancel
Save