radio: protect concurrent access from tx_end and tx

master
Ismael Gomez 3 years ago
parent 0de984d12f
commit bf566fbd29

@ -173,6 +173,9 @@ private:
*/
bool tx_dev(const uint32_t& device_idx, rf_buffer_interface& buffer, const srsran_timestamp_t& tx_time_);
// private unprotected tx_end implementation
void tx_end_nolock();
/**
* Helper method for receiving over a single RF device. This function maps automatically the logical receive buffers
* to the physical RF buffers for the given device.

@ -539,7 +539,7 @@ bool radio::tx_dev(const uint32_t& device_idx, rf_buffer_interface& buffer, cons
// if the gap is bigger than TX_MAX_GAP_ZEROS, stop burst
if (fabs(srsran_timestamp_real(&ts_overlap)) > tx_max_gap_zeros) {
logger.info("Detected RF gap of %.1f us. Sending end-of-burst.", srsran_timestamp_real(&ts_overlap) * 1.0e6);
tx_end();
tx_end_nolock();
} else {
logger.debug("Detected RF gap of %.1f us. Tx'ing zeroes.", srsran_timestamp_real(&ts_overlap) * 1.0e6);
// Otherwise, transmit zeros
@ -592,6 +592,12 @@ bool radio::tx_dev(const uint32_t& device_idx, rf_buffer_interface& buffer, cons
}
void radio::tx_end()
{
std::unique_lock<std::mutex> lock(tx_mutex);
tx_end_nolock();
}
void radio::tx_end_nolock()
{
if (!is_initialized) {
return;

Loading…
Cancel
Save