aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2/io_impl.cpp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-04-21 22:33:16 -0700
committerMartin Braun <martin.braun@ettus.com>2017-06-28 15:54:39 -0700
commitcb1649d201e41c85ed77256712309706ed1a805d (patch)
tree1aaa11ac2bba1eb95edc9303b3ad42fc254913d5 /host/lib/usrp/usrp2/io_impl.cpp
parentf19e4602f10fb86dceb4d65d75741f98a054a7df (diff)
downloaduhd-cb1649d201e41c85ed77256712309706ed1a805d.tar.gz
uhd-cb1649d201e41c85ed77256712309706ed1a805d.tar.bz2
uhd-cb1649d201e41c85ed77256712309706ed1a805d.zip
uhd: tasks now use std::threads under the hood, and can't be interrupted
USRP1 and USRP2 used tasks that relied on Boost thread interruption mechanisms. These were replaced with explicit atomics.
Diffstat (limited to 'host/lib/usrp/usrp2/io_impl.cpp')
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp
index 992d70835..8f6a67453 100644
--- a/host/lib/usrp/usrp2/io_impl.cpp
+++ b/host/lib/usrp/usrp2/io_impl.cpp
@@ -165,7 +165,7 @@ struct usrp2_impl::io_impl{
std::vector<flow_control_monitor::sptr> fc_mons;
//methods and variables for the pirate crew
- void recv_pirate_loop(zero_copy_if::sptr, size_t);
+ void recv_pirate_loop(zero_copy_if::sptr, size_t, const std::atomic<bool> &);
std::list<task::sptr> pirate_tasks;
bounded_buffer<async_metadata_t> async_msg_fifo;
double tick_rate;
@@ -178,14 +178,14 @@ struct usrp2_impl::io_impl{
* - put async message packets into queue
**********************************************************************/
void usrp2_impl::io_impl::recv_pirate_loop(
- zero_copy_if::sptr err_xport, size_t index
+ zero_copy_if::sptr err_xport, size_t index, const std::atomic<bool> &exit_loop
){
set_thread_priority_safe();
//store a reference to the flow control monitor (offset by max dsps)
flow_control_monitor &fc_mon = *(this->fc_mons[index]);
- while (not boost::this_thread::interruption_requested()){
+ while (not exit_loop){
managed_recv_buffer::sptr buff = err_xport->get_recv_buff();
if (not buff.get()) continue; //ignore timeout/error buffers
@@ -252,7 +252,8 @@ void usrp2_impl::io_init(void){
//spawn a new pirate to plunder the recv booty
_io_impl->pirate_tasks.push_back(task::make(boost::bind(
&usrp2_impl::io_impl::recv_pirate_loop, _io_impl.get(),
- _mbc[mb].tx_dsp_xport, index++
+ _mbc[mb].tx_dsp_xport, index++,
+ boost::ref(_pirate_task_exit)
)));
}
}