diff options
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/usrp/usrp2/io_impl.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index 83b70bddc..4d9528f66 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -73,6 +73,7 @@ struct usrp2_impl::io_impl{ bool recv_pirate_crew_raiding; alignment_buffer_type::sptr recv_pirate_booty; bounded_buffer<async_metadata_t>::sptr async_msg_fifo; + boost::mutex spawn_mutex; }; /*********************************************************************** @@ -89,6 +90,8 @@ void usrp2_impl::io_impl::recv_pirate_loop( recv_pirate_crew_raiding = true; size_t next_packet_seq = 0; + spawn_mutex.unlock(); + while(recv_pirate_crew_raiding){ managed_recv_buffer::sptr buff = zc_if->get_recv_buff(); if (not buff.get()) continue; //ignore timeout/error buffers @@ -162,11 +165,17 @@ void usrp2_impl::io_init(void){ //create a new pirate thread for each zc if (yarr!!) for (size_t i = 0; i < _data_transports.size(); i++){ + //ensure a non-blocking mutex lock + _io_impl->spawn_mutex.unlock(); + _io_impl->spawn_mutex.lock(); + //spawn a new pirate to plunder the recv booty _io_impl->recv_pirate_crew.create_thread(boost::bind( &usrp2_impl::io_impl::recv_pirate_loop, _io_impl.get(), _data_transports.at(i), _mboards.at(i), i )); + //will block here until the thread unlocks + _io_impl->spawn_mutex.lock(); } } |