[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 03/04: gr-uhd: disable boost thread interru
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 03/04: gr-uhd: disable boost thread interrupts during send() and recv() calls in work (next edition) |
Date: |
Wed, 14 Dec 2016 01:25:18 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch next
in repository gnuradio.
commit 3ab7e037f978d3095636969d343a361a0b962723
Merge: 9001c08 bd18ea1
Author: Martin Braun <address@hidden>
Date: Tue Dec 13 16:52:35 2016 -0800
gr-uhd: disable boost thread interrupts during send() and recv() calls in
work (next edition)
gr-uhd/lib/usrp_sink_impl.cc | 2 ++
gr-uhd/lib/usrp_source_impl.cc | 2 ++
2 files changed, 4 insertions(+)
diff --cc gr-uhd/lib/usrp_sink_impl.cc
index 8798a68,bd56e99..4e2e946
--- a/gr-uhd/lib/usrp_sink_impl.cc
+++ b/gr-uhd/lib/usrp_sink_impl.cc
@@@ -336,10 -375,17 +336,12 @@@ namespace gr
}
}
- boost::this_thread::disable_interruption disable_interrupt;
-#ifdef GR_UHD_USE_STREAM_API
//send all ninput_items with metadata
- const size_t num_sent = _tx_stream->send
- (input_items, ninput_items, _metadata, 1.0);
-#else
- const size_t num_sent = _dev->get_device()->send
- (input_items, ninput_items, _metadata,
- *_type, ::uhd::device::SEND_MODE_FULL_BUFF, 1.0);
-#endif
++ boost::this_thread::disable_interruption disable_interrupt;
+ const size_t num_sent = _tx_stream->send(
+ input_items, ninput_items, _metadata, 1.0
+ );
+ boost::this_thread::restore_interruption
restore_interrupt(disable_interrupt);
//if using length_tags, decrement items left to send by the number of
samples sent
if(not pmt::is_null(_length_tag_key) && _nitems_to_send > 0) {
diff --cc gr-uhd/lib/usrp_source_impl.cc
index a4ff310,11b6300..8cdaebc
--- a/gr-uhd/lib/usrp_source_impl.cc
+++ b/gr-uhd/lib/usrp_source_impl.cc
@@@ -561,6 -618,8 +561,7 @@@ namespace gr
gr_vector_void_star &output_items)
{
boost::recursive_mutex::scoped_lock lock(d_mutex);
+ boost::this_thread::disable_interruption disable_interrupt;
-#ifdef GR_UHD_USE_STREAM_API
//In order to allow for low-latency:
//We receive all available packets without timeout.
//This call can timeout under regular operation...
@@@ -571,8 -630,19 +572,9 @@@
_recv_timeout,
true /* one packet -> minimize latency */
);
-#else
- size_t num_samps = _dev->get_device()->recv
- (output_items, noutput_items, _metadata,
- *_type, ::uhd::device::RECV_MODE_FULL_BUFF, 0.0);
-
- if(_metadata.error_code == ::uhd::rx_metadata_t::ERROR_CODE_TIMEOUT) {
- num_samps = _dev->get_device()->recv
- (output_items, noutput_items, _metadata, *_type,
- ::uhd::device::RECV_MODE_ONE_PACKET, 1.0);
- }
-#endif
+ boost::this_thread::restore_interruption
restore_interrupt(disable_interrupt);
- // handle possible errors conditions
+
+ //handle possible errors conditions
switch(_metadata.error_code) {
case ::uhd::rx_metadata_t::ERROR_CODE_NONE:
if(_tag_now) {