summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2012-02-17 11:39:59 -0500
committerTom Rondeau <trondeau@vt.edu>2012-02-17 11:39:59 -0500
commit114cd4ae4b544cde983c7d7bd47cdd354877afde (patch)
tree5e93f26684810dc5496280babf8b60d71e56fead
parent2eee2b14349c1c36b79131fe327d9040eca6d140 (diff)
core: in delay block, protect against repeated calls to set_delay with the same value.
-rw-r--r--gnuradio-core/src/lib/general/gr_delay.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/gnuradio-core/src/lib/general/gr_delay.cc b/gnuradio-core/src/lib/general/gr_delay.cc
index cf868b37b2..30c9a235d1 100644
--- a/gnuradio-core/src/lib/general/gr_delay.cc
+++ b/gnuradio-core/src/lib/general/gr_delay.cc
@@ -55,11 +55,16 @@ gr_delay::forecast (int noutput_items, gr_vector_int &ninput_items_required)
void
gr_delay::set_delay (int d)
-{
- gruel::scoped_lock l(d_mutex_delay);
- int old = delay();
- set_history(d+1);
- d_delta = delay() - old;
+{
+ // only set a new delta if there is a change in the delay; this
+ // protects from quickly-repeated calls to this function that would
+ // end with d_delta=0.
+ if(d != delay()) {
+ gruel::scoped_lock l(d_mutex_delay);
+ int old = delay();
+ set_history(d+1);
+ d_delta = delay() - old;
+ }
}
int