Fix concurrent issues in dummy radio used in nr_phy_test

master
Xavier Arteaga 3 years ago committed by Xavier Arteaga
parent 8a7a4a588d
commit 66f6c11561

@ -45,7 +45,7 @@ private:
std::vector<srsran_ringbuffer_t> rx_ring_buffers; std::vector<srsran_ringbuffer_t> rx_ring_buffers;
std::vector<srsran_ringbuffer_t> tx_ring_buffers; std::vector<srsran_ringbuffer_t> tx_ring_buffers;
std::mutex tx_mutex; std::mutex tx_mutex;
double srate_hz = 0.0f; std::atomic<double> srate_hz = {0.0f};
std::atomic<float> rx_gain = {1.0f}; std::atomic<float> rx_gain = {1.0f};
std::atomic<float> tx_gain = {1.0f}; std::atomic<float> tx_gain = {1.0f};
cf_t* temp_buffer = nullptr; cf_t* temp_buffer = nullptr;
@ -211,9 +211,12 @@ public:
uint64_t tx_time_n = srsran_timestamp_uint64(&tx_time.get(0), srate_hz); uint64_t tx_time_n = srsran_timestamp_uint64(&tx_time.get(0), srate_hz);
// Check if the transmission is in the past // Check if the transmission is in the past
if (tx_time_n < tx_timestamp) { {
logger.error("Error transmission in the past for %d samples", (int)(tx_timestamp - tx_time_n)); std::lock_guard<std::mutex> lock(tx_mutex);
return false; if (tx_time_n < tx_timestamp) {
logger.error("Error transmission in the past for %d samples", (int)(tx_timestamp - tx_time_n));
return false;
}
} }
// Advance TX to timestamp // Advance TX to timestamp

Loading…
Cancel
Save