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/device3 | |
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/device3')
-rw-r--r-- | host/lib/usrp/device3/device3_impl.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/device3/device3_impl.hpp | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/host/lib/usrp/device3/device3_impl.cpp b/host/lib/usrp/device3/device3_impl.cpp index f680e5a74..35faf601f 100644 --- a/host/lib/usrp/device3/device3_impl.cpp +++ b/host/lib/usrp/device3/device3_impl.cpp @@ -28,7 +28,6 @@ using namespace uhd::usrp; device3_impl::device3_impl() - : _sid_framer(0) { _type = uhd::device::USRP; _async_md.reset(new async_md_type(1000/*messages deep*/)); @@ -172,7 +171,10 @@ void device3_impl::enumerate_rfnoc_blocks( make_args.base_address = xport.send_sid.get_dst(); make_args.device_index = device_index; make_args.tree = subtree; - _rfnoc_block_ctrl.push_back(uhd::rfnoc::block_ctrl_base::make(make_args, noc_id)); + { //Critical section for block_ctrl vector access + boost::lock_guard<boost::mutex> lock(_block_ctrl_mutex); + _rfnoc_block_ctrl.push_back(uhd::rfnoc::block_ctrl_base::make(make_args, noc_id)); + } } } diff --git a/host/lib/usrp/device3/device3_impl.hpp b/host/lib/usrp/device3/device3_impl.hpp index c496b5105..c2ec26f80 100644 --- a/host/lib/usrp/device3/device3_impl.hpp +++ b/host/lib/usrp/device3/device3_impl.hpp @@ -172,9 +172,6 @@ protected: /*********************************************************************** * Members **********************************************************************/ - //! A counter, designed to create unique SIDs - size_t _sid_framer; - // TODO: Maybe move these to private uhd::dict<std::string, boost::weak_ptr<uhd::rx_streamer> > _rx_streamers; uhd::dict<std::string, boost::weak_ptr<uhd::tx_streamer> > _tx_streamers; |