From 4ab72eb9991d503d8cd329b31572d966ef0e1ae8 Mon Sep 17 00:00:00 2001 From: Ashish Chaudhari Date: Tue, 4 Apr 2017 19:21:31 -0700 Subject: device3: Fixed potential concurreny issues - Protected block_ctrl vector with a mutex - Note: const block accessors are not thread safe - Removed sid_framer from base device3 class - Made x300,e300 sid_framers atomic --- host/lib/usrp/e300/e300_impl.cpp | 8 +++----- host/lib/usrp/e300/e300_impl.hpp | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'host/lib/usrp/e300') diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp index ea326878e..20dd89dd1 100644 --- a/host/lib/usrp/e300/e300_impl.cpp +++ b/host/lib/usrp/e300/e300_impl.cpp @@ -747,15 +747,16 @@ uint32_t e300_impl::_allocate_sid(const sid_config_t &config) { const uint32_t stream = (config.dst_prefix | (config.router_dst_there << 2)) & 0xff; + const size_t sid_framer = _sid_framer++; //increment for next setup const uint32_t sid = 0 | (E300_DEVICE_HERE << 24) - | (_sid_framer << 16) + | (sid_framer << 16) | (config.router_addr_there << 8) | (stream << 0) ; UHD_LOGGER_DEBUG("E300")<< std::hex << " sid 0x" << sid - << " framer 0x" << _sid_framer + << " framer 0x" << sid_framer << " stream 0x" << stream << " router_dst_there 0x" << int(config.router_dst_there) << " router_addr_there 0x" << int(config.router_addr_there) @@ -779,9 +780,6 @@ uint32_t e300_impl::_allocate_sid(const sid_config_t &config) << "done router config for sid 0x" << sid << std::dec ; - //increment for next setup - _sid_framer++; - return sid; } diff --git a/host/lib/usrp/e300/e300_impl.hpp b/host/lib/usrp/e300/e300_impl.hpp index 50d78fdd4..cc2e39e23 100644 --- a/host/lib/usrp/e300/e300_impl.hpp +++ b/host/lib/usrp/e300/e300_impl.hpp @@ -47,6 +47,7 @@ #include "e300_i2c.hpp" #include "e300_eeprom_manager.hpp" #include "e300_sensor_manager.hpp" +#include /* if we don't compile with gpsd support, don't bother */ #ifdef E300_GPSD @@ -288,7 +289,7 @@ private: // members uhd::device_addr_t _device_addr; xport_t _xport_path; e300_fifo_interface::sptr _fifo_iface; - size_t _sid_framer; + std::atomic _sid_framer; radio_perifs_t _radio_perifs[2]; double _tick_rate; ad9361_ctrl::sptr _codec_ctrl; -- cgit v1.2.3