aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2/io_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/usrp2/io_impl.cpp')
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp9
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 844df603c..7b10e383e 100644
--- a/host/lib/usrp/usrp2/io_impl.cpp
+++ b/host/lib/usrp/usrp2/io_impl.cpp
@@ -164,6 +164,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;
};
/***********************************************************************
@@ -180,6 +181,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
@@ -252,11 +255,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();
}
}