diff options
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_block.h | 6 | ||||
-rw-r--r-- | gr-analog/lib/noise_source_X_impl.cc.t | 16 | ||||
-rw-r--r-- | gr-analog/lib/noise_source_X_impl.h.t | 4 | ||||
-rw-r--r-- | gr-blocks/grc/blocks_block_tree.xml | 2 | ||||
-rw-r--r-- | gr-filter/lib/fir_filter_XXX_impl.cc.t | 3 |
5 files changed, 28 insertions, 3 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 034f6136d9..acd938080a 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -628,6 +628,12 @@ class GR_CORE_API gr_block : public gr_basic_block { std::vector<long> d_max_output_buffer; std::vector<long> d_min_output_buffer; + /*! Used by block's setters and work functions to make + * setting/resetting of parameters thread-safe. + * + * Used by calling gruel::scoped_lock l(d_setlock); + */ + gruel::mutex d_setlock; // These are really only for internal use, but leaving them public avoids // having to work up an ever-varying list of friend GR_CORE_APIs diff --git a/gr-analog/lib/noise_source_X_impl.cc.t b/gr-analog/lib/noise_source_X_impl.cc.t index 35dda9c5d4..40e2517d2e 100644 --- a/gr-analog/lib/noise_source_X_impl.cc.t +++ b/gr-analog/lib/noise_source_X_impl.cc.t @@ -54,11 +54,27 @@ namespace gr { { } + void + @IMPL_NAME@::set_type(noise_type_t type) + { + gruel::scoped_lock l(d_setlock); + d_type = type; + } + + void + @IMPL_NAME@::set_amplitude(float ampl) + { + gruel::scoped_lock l(d_setlock); + d_ampl = ampl; + } + int @IMPL_NAME@::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { + gruel::scoped_lock l(d_setlock); + @TYPE@ *out = (@TYPE@*)output_items[0]; switch(d_type) { diff --git a/gr-analog/lib/noise_source_X_impl.h.t b/gr-analog/lib/noise_source_X_impl.h.t index 8bcc1dfde3..3a0e8d6d7c 100644 --- a/gr-analog/lib/noise_source_X_impl.h.t +++ b/gr-analog/lib/noise_source_X_impl.h.t @@ -41,8 +41,8 @@ namespace gr { @IMPL_NAME@(noise_type_t type, float ampl, long seed = 0); ~@IMPL_NAME@(); - void set_type(noise_type_t type) { d_type = type; } - void set_amplitude(float ampl) { d_ampl = ampl; } + void set_type(noise_type_t type); + void set_amplitude(float ampl); noise_type_t type() const { return d_type; } float amplitude() const { return d_ampl; } diff --git a/gr-blocks/grc/blocks_block_tree.xml b/gr-blocks/grc/blocks_block_tree.xml index 4f5e372d3e..7f5a13abb7 100644 --- a/gr-blocks/grc/blocks_block_tree.xml +++ b/gr-blocks/grc/blocks_block_tree.xml @@ -103,7 +103,7 @@ <block>blocks_peak_detector2_fb</block> <block>blocks_regenerate_bb</block> <block>blocks_stretch_ff</block> - <block>blocks_threadhold_ff</block> + <block>blocks_threshold_ff</block> </cat> <cat> <name>Misc (New) </name> diff --git a/gr-filter/lib/fir_filter_XXX_impl.cc.t b/gr-filter/lib/fir_filter_XXX_impl.cc.t index 529c51e2bb..319c267270 100644 --- a/gr-filter/lib/fir_filter_XXX_impl.cc.t +++ b/gr-filter/lib/fir_filter_XXX_impl.cc.t @@ -64,6 +64,7 @@ namespace gr { void @IMPL_NAME@::set_taps(const std::vector<@TAP_TYPE@> &taps) { + gruel::scoped_lock l(d_setlock); d_fir->set_taps(taps); d_updated = true; } @@ -79,6 +80,8 @@ namespace gr { gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { + gruel::scoped_lock l(d_setlock); + const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0]; @O_TYPE@ *out = (@O_TYPE@*)output_items[0]; |