diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2015-03-04 10:03:46 -0800 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2015-03-04 10:03:46 -0800 |
commit | ee369b92a5e7de35feb85add091b8ad79cd7d7a2 (patch) | |
tree | 40daa4c7eb86e8e38633916ea12f32eeebe486aa | |
parent | d525e7e5e81a7eff6163a918a18ed1a2de0a8675 (diff) | |
parent | 41f1ba4171b74354ab25cf066451d8ba940d9ec4 (diff) |
Merge branch 'maint'
-rw-r--r-- | gr-blocks/lib/throttle_impl.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gr-blocks/lib/throttle_impl.cc b/gr-blocks/lib/throttle_impl.cc index 7c24f80ae1..d818ce192b 100644 --- a/gr-blocks/lib/throttle_impl.cc +++ b/gr-blocks/lib/throttle_impl.cc @@ -28,6 +28,7 @@ #include <gnuradio/io_signature.h> #include <cstring> #include <boost/thread/thread.hpp> +#include <limits> pmt::pmt_t throttle_rx_rate_pmt(pmt::intern("rx_rate")); @@ -107,8 +108,13 @@ namespace gr { //if the expected samples was less, we need to throttle back if(d_total_samples > expected_samps) { + double sleep_time = (d_total_samples - expected_samps)/d_samps_per_us; + if (std::numeric_limits<long>::max() < sleep_time) { + GR_LOG_ALERT(d_logger, "WARNING: Throttle sleep time overflow! You " + "are probably using a very low sample rate."); + } boost::this_thread::sleep(boost::posix_time::microseconds - (long((d_total_samples - expected_samps)/d_samps_per_us))); + (long(sleep_time))); } //copy all samples output[i] <= input[i] |