diff options
author | Ashish Chaudhari <ashish@ettus.com> | 2017-04-04 19:21:31 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-04-05 17:16:31 -0700 |
commit | 4ab72eb9991d503d8cd329b31572d966ef0e1ae8 (patch) | |
tree | 65daea22e4f3dcb25b6d562b82b97da2b4887d88 /host/lib/usrp/x300 | |
parent | 15d9c6850c23c867c8ec823dedd20c7ec09d7e6b (diff) | |
download | uhd-4ab72eb9991d503d8cd329b31572d966ef0e1ae8.tar.gz uhd-4ab72eb9991d503d8cd329b31572d966ef0e1ae8.tar.bz2 uhd-4ab72eb9991d503d8cd329b31572d966ef0e1ae8.zip |
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
Diffstat (limited to 'host/lib/usrp/x300')
-rw-r--r-- | host/lib/usrp/x300/x300_impl.cpp | 5 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_impl.hpp | 3 |
2 files changed, 3 insertions, 5 deletions
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 <uhd/rfnoc/block_ctrl.hpp> ///////////// RFNOC ///////////////////// #include <boost/dynamic_bitset.hpp> +#include <atomic> 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<size_t> _sid_framer; uhd::sid_t allocate_sid( mboard_members_t &mb, |