From d8e73d63c0af6ba6810319d866cab07b332d0e42 Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Tue, 26 Feb 2013 12:00:47 -0500
Subject: core: adding a mutex as a protected member of gr_block for use in
 protecting set and work function access to variables.

This is used in gr-analog's noise_source and gr-filter's fir_filter_XXX since these two cause particular problems (in next's channel model). This shows the use of the mutex for general protection when needed.
---
 gnuradio-core/src/lib/runtime/gr_block.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'gnuradio-core/src/lib/runtime')

diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h
index 6e21d5b975..0783e86848 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_block.h
@@ -484,9 +484,9 @@ class GR_CORE_API gr_block : public gr_basic_block {
   gr_block_detail_sptr	d_detail;		// implementation details
   unsigned              d_history;
   bool                  d_fixed_rate;
-  int                   d_min_noutput_items;
   bool                  d_max_noutput_items_set;     // if d_max_noutput_items is valid
   int                   d_max_noutput_items;         // value of max_noutput_items for this block
+  int                   d_min_noutput_items;
   tag_propagation_policy_t d_tag_propagation_policy; // policy for moving tags downstream
   std::vector<unsigned int> d_affinity;              // thread affinity proc. mask
 
@@ -609,6 +609,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
-- 
cgit v1.2.3


From 5a5338f584297f30e451e43dcb05f331cad51cd4 Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Wed, 27 Feb 2013 18:32:31 -0500
Subject: ctrlport: adding option to toggle export of the list of edges on/off.

---
 gnuradio-core/gnuradio-core.conf              |  1 +
 gnuradio-core/src/lib/runtime/gr_top_block.cc | 16 +++++++++-------
 2 files changed, 10 insertions(+), 7 deletions(-)

(limited to 'gnuradio-core/src/lib/runtime')

diff --git a/gnuradio-core/gnuradio-core.conf b/gnuradio-core/gnuradio-core.conf
index 3ed9892c73..cf3df4aea7 100644
--- a/gnuradio-core/gnuradio-core.conf
+++ b/gnuradio-core/gnuradio-core.conf
@@ -12,4 +12,5 @@ export = True
 
 [ControlPort]
 on = False
+edges_list = False
 config = # ${prefix}/etc/gnuradio/ctrlport.conf
diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.cc b/gnuradio-core/src/lib/runtime/gr_top_block.cc
index e5859768de..c6118bcfdd 100644
--- a/gnuradio-core/src/lib/runtime/gr_top_block.cc
+++ b/gnuradio-core/src/lib/runtime/gr_top_block.cc
@@ -138,13 +138,15 @@ gr_top_block::setup_rpc()
 	 "items", "Max number of output items",
 	 RPC_PRIVLVL_MIN, DISPNULL)));
 
-  add_rpc_variable(
-      rpcbasic_sptr(new rpcbasic_register_get<gr_top_block, std::string>(
-	 alias(), "edge list",
-	 &gr_top_block::edge_list,
-	 pmt::mp(""), pmt::mp(""), pmt::mp(""),
-	 "edges", "List of edges in the graph",
-	 RPC_PRIVLVL_MIN, DISPNULL)));
+  if(gr_prefs::singleton()->get_bool("ControlPort", "edges_list", false)) {
+    add_rpc_variable(
+        rpcbasic_sptr(new rpcbasic_register_get<gr_top_block, std::string>(
+	   alias(), "edge list",
+	   &gr_top_block::edge_list,
+           pmt::mp(""), pmt::mp(""), pmt::mp(""),
+           "edges", "List of edges in the graph",
+           RPC_PRIVLVL_MIN, DISPNULL)));
+  }
 
   // Setters
   add_rpc_variable(
-- 
cgit v1.2.3