summaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-11-16 11:59:23 -0800
committerJosh Blum <josh@joshknows.com>2010-11-16 11:59:23 -0800
commitc5043c6aec21c9acadfb81594e5c7d10709fdba5 (patch)
treeb9221864363da7a1d7c0259a807b9936cc578033 /host/lib
parent41e7d1e4026bdb9efe4430351a42ef5d7ecc152d (diff)
downloaduhd-c5043c6aec21c9acadfb81594e5c7d10709fdba5.tar.gz
uhd-c5043c6aec21c9acadfb81594e5c7d10709fdba5.tar.bz2
uhd-c5043c6aec21c9acadfb81594e5c7d10709fdba5.zip
usrp: use a spawn thread to ensure that a pirate is spawned before continuing (fixes lockup issue)
Diffstat (limited to 'host/lib')
-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 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();
}
}