summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src/lib')
-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 cf868b37b..30c9a235d 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