[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 08/16: analog: Wrapped squelch blocks' sett
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 08/16: analog: Wrapped squelch blocks' setter methods with lock |
Date: |
Sun, 29 Mar 2015 02:27:26 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 816eb840fd86000b12525ff28d128fe643a15a73
Author: Jon Szymaniak <address@hidden>
Date: Tue Mar 24 11:52:45 2015 -0400
analog: Wrapped squelch blocks' setter methods with lock
The setter methods of squelch_base and its children have been updated to
hold d_setlock to avoid races.
For example, updating the CTCSS frequency parameter requires
updates to three separate fft::goertzel objects, which are used during
the general_work().
---
gr-analog/lib/ctcss_squelch_ff_impl.cc | 15 +++++++++++++++
gr-analog/lib/ctcss_squelch_ff_impl.h | 9 ++-------
gr-analog/lib/pwr_squelch_cc_impl.cc | 14 ++++++++++++++
gr-analog/lib/pwr_squelch_cc_impl.h | 4 ++--
gr-analog/lib/squelch_base_cc_impl.cc | 4 ++++
5 files changed, 37 insertions(+), 9 deletions(-)
diff --git a/gr-analog/lib/ctcss_squelch_ff_impl.cc
b/gr-analog/lib/ctcss_squelch_ff_impl.cc
index fb34485..7edda64 100644
--- a/gr-analog/lib/ctcss_squelch_ff_impl.cc
+++ b/gr-analog/lib/ctcss_squelch_ff_impl.cc
@@ -149,5 +149,20 @@ namespace gr {
}
}
+ void
+ ctcss_squelch_ff_impl::set_level(float level)
+ {
+ gr::thread::scoped_lock l(d_setlock);
+ d_level = level;
+ }
+
+ void
+ ctcss_squelch_ff_impl::set_frequency(float frequency)
+ {
+ gr::thread::scoped_lock l(d_setlock);
+ d_freq = frequency;
+ update_fft_params();
+ }
+
} /* namespace analog */
} /* namespace gr */
diff --git a/gr-analog/lib/ctcss_squelch_ff_impl.h
b/gr-analog/lib/ctcss_squelch_ff_impl.h
index 67ce66c..f6e12de 100644
--- a/gr-analog/lib/ctcss_squelch_ff_impl.h
+++ b/gr-analog/lib/ctcss_squelch_ff_impl.h
@@ -59,15 +59,10 @@ namespace gr {
std::vector<float> squelch_range() const;
float level() const { return d_level; }
- void set_level(float level) { d_level = level; }
+ void set_level(float level);
int len() const { return d_len; }
float frequency() const { return d_freq; }
-
- void set_frequency(float frequency)
- {
- d_freq = frequency;
- update_fft_params();
- }
+ void set_frequency(float frequency);
int ramp() const { return squelch_base_ff_impl::ramp(); }
void set_ramp(int ramp) { squelch_base_ff_impl::set_ramp(ramp); }
diff --git a/gr-analog/lib/pwr_squelch_cc_impl.cc
b/gr-analog/lib/pwr_squelch_cc_impl.cc
index 1a414ed..62b9cff 100644
--- a/gr-analog/lib/pwr_squelch_cc_impl.cc
+++ b/gr-analog/lib/pwr_squelch_cc_impl.cc
@@ -69,5 +69,19 @@ namespace gr {
d_pwr = d_iir.filter(in.real()*in.real()+in.imag()*in.imag());
}
+ void
+ pwr_squelch_cc_impl::set_threshold(double db)
+ {
+ gr::thread::scoped_lock l(d_setlock);
+ d_threshold = std::pow(10.0, db/10);
+ }
+
+ void
+ pwr_squelch_cc_impl::set_alpha(double alpha)
+ {
+ gr::thread::scoped_lock l(d_setlock);
+ d_iir.set_taps(alpha);
+ }
+
} /* namespace analog */
} /* namespace gr */
diff --git a/gr-analog/lib/pwr_squelch_cc_impl.h
b/gr-analog/lib/pwr_squelch_cc_impl.h
index eea881a..d72ad58 100644
--- a/gr-analog/lib/pwr_squelch_cc_impl.h
+++ b/gr-analog/lib/pwr_squelch_cc_impl.h
@@ -51,8 +51,8 @@ namespace gr {
std::vector<float> squelch_range() const;
double threshold() const { return 10*log10(d_threshold); }
- void set_threshold(double db) { d_threshold = std::pow(10.0, db/10); }
- void set_alpha(double alpha) { d_iir.set_taps(alpha); }
+ void set_threshold(double db);
+ void set_alpha(double alpha);
int ramp() const { return squelch_base_cc_impl::ramp(); }
void set_ramp(int ramp) { squelch_base_cc_impl::set_ramp(ramp); }
diff --git a/gr-analog/lib/squelch_base_cc_impl.cc
b/gr-analog/lib/squelch_base_cc_impl.cc
index c62efc3..3255d3b 100644
--- a/gr-analog/lib/squelch_base_cc_impl.cc
+++ b/gr-analog/lib/squelch_base_cc_impl.cc
@@ -55,6 +55,7 @@ namespace gr {
void
squelch_base_cc_impl::set_ramp(int ramp)
{
+ gr::thread::scoped_lock l(d_setlock);
d_ramp = ramp;
}
@@ -67,6 +68,7 @@ namespace gr {
void
squelch_base_cc_impl::set_gate(bool gate)
{
+ gr::thread::scoped_lock l(d_setlock);
d_gate = gate;
}
@@ -87,6 +89,8 @@ namespace gr {
int j = 0;
+ gr::thread::scoped_lock l(d_setlock);
+
for(int i = 0; i < noutput_items; i++) {
update_state(in[i]);
- [Commit-gnuradio] [gnuradio] branch master updated (28ba7e4 -> 72c11a0), git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 10/16: gr-uhd: support for IQ imbalance enable/disable, git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 15/16: Merge remote-tracking branch 'jarn0ld/jarn0ld/uhd-iq-imbalance-on-off', git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 08/16: analog: Wrapped squelch blocks' setter methods with lock,
git <=
- [Commit-gnuradio] [gnuradio] 03/16: analog: Added frequency accessor and modifier to CTCSS squelch, git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 06/16: filter: exporting IIR filter kernels from library., git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 14/16: Merge remote-tracking branch 'drmpeg/dvb-s2', git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 01/16: analog: Made CTCSS squelch find_tone() a static member function, git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 13/16: Merge remote-tracking branch 'tom/iir_filter_stability', git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 11/16: gr-dtv: Fix ATSC compile issue as reported on mailing list., git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 12/16: Merge remote-tracking branch 'jynik/ctcss_squelch_add_freq_getset', git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 16/16: Merge remote-tracking branch 'drmpeg/atsc-fix', git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 05/16: docs: adding better docs for using IIR kernels., git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 09/16: gr-dtv: Add DVB-S2 transmitter update., git, 2015/03/28