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/x300/x300_impl.cpp | 5 +---- host/lib/usrp/x300/x300_impl.hpp | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'host/lib/usrp/x300') diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index c9a73db16..8e48c606a 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -1307,7 +1307,7 @@ uhd::sid_t x300_impl::allocate_sid( ) { uhd::sid_t sid = address; sid.set_src_addr(src_addr); - sid.set_src_endpoint(_sid_framer); + sid.set_src_endpoint(_sid_framer++); //increment for next setup // TODO Move all of this setup_mb() // Program the X300 to recognise it's own local address. @@ -1321,9 +1321,6 @@ uhd::sid_t x300_impl::allocate_sid( UHD_LOGGER_DEBUG("X300") << "done router config for sid " << sid ; - //increment for next setup - _sid_framer++; - return sid; } diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp index 7bb624577..2de295bd9 100644 --- a/host/lib/usrp/x300/x300_impl.hpp +++ b/host/lib/usrp/x300/x300_impl.hpp @@ -39,6 +39,7 @@ #include ///////////// RFNOC ///////////////////// #include +#include static const std::string X300_FW_FILE_NAME = "usrp_x300_fw.bin"; static const std::string X300_DEFAULT_CLOCK_SOURCE = "internal"; @@ -215,7 +216,7 @@ private: //task for periodically reclaiming the device from others void claimer_loop(uhd::wb_iface::sptr); - size_t _sid_framer; + std::atomic _sid_framer; uhd::sid_t allocate_sid( mboard_members_t &mb, -- cgit v1.2.3