aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authormichael-west <michael.west@ettus.com>2016-07-19 14:45:11 -0700
committerMartin Braun <martin.braun@ettus.com>2016-07-22 11:31:40 -0700
commit4d88b797279aeb76fdf1f595c209123bc9361617 (patch)
treef2cf67e59ff1bdc881e79784a75e52713874329d /host
parent446e922d887e06c1fe8f61af36a277b38740d376 (diff)
downloaduhd-4d88b797279aeb76fdf1f595c209123bc9361617.tar.gz
uhd-4d88b797279aeb76fdf1f595c209123bc9361617.tar.bz2
uhd-4d88b797279aeb76fdf1f595c209123bc9361617.zip
examples: Fix RX thread in benchmark_rate example so it exits when EOB is seen
Diffstat (limited to 'host')
-rw-r--r--host/examples/benchmark_rate.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/host/examples/benchmark_rate.cpp b/host/examples/benchmark_rate.cpp
index f395b1062..c58d4f5ae 100644
--- a/host/examples/benchmark_rate.cpp
+++ b/host/examples/benchmark_rate.cpp
@@ -85,10 +85,12 @@ void benchmark_rx_rate(
const float burst_pkt_time = std::max(0.100, (2 * max_samps_per_packet/rate));
float recv_timeout = burst_pkt_time + INIT_DELAY;
+ bool stop_called = false;
while (true) {
- //if (burst_timer_elapsed.load(boost::memory_order_relaxed)) {
- if (burst_timer_elapsed) {
+ //if (burst_timer_elapsed.load(boost::memory_order_relaxed) and not stop_called) {
+ if (burst_timer_elapsed and not stop_called) {
rx_stream->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
+ stop_called = true;
}
if (random_nsamps) {
cmd.num_samps = rand() % max_samps_per_packet;
@@ -111,6 +113,10 @@ void benchmark_rx_rate(
had_an_overflow = false;
num_dropped_samps += (md.time_spec - last_time).to_ticks(rate);
}
+ if ((burst_timer_elapsed or stop_called) and md.end_of_burst)
+ {
+ return;
+ }
break;
// ERROR_CODE_OVERFLOW can indicate overflow or sequence error