From 4d88b797279aeb76fdf1f595c209123bc9361617 Mon Sep 17 00:00:00 2001 From: michael-west Date: Tue, 19 Jul 2016 14:45:11 -0700 Subject: examples: Fix RX thread in benchmark_rate example so it exits when EOB is seen --- host/examples/benchmark_rate.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'host/examples') 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 -- cgit v1.2.3