commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 11/21: runtime: android: more conversion of


From: git
Subject: [Commit-gnuradio] [gnuradio] 11/21: runtime: android: more conversion of statics vars to static functions.
Date: Sat, 9 May 2015 14:05:37 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

trondeau pushed a commit to branch android
in repository gnuradio.

commit 65511d9708150eda687ba549b367a4c1988e3d53
Author: Tom Rondeau <address@hidden>
Date:   Thu Mar 12 10:57:23 2015 -0400

    runtime: android: more conversion of statics vars to static functions.
---
 gnuradio-runtime/include/gnuradio/block_registry.h |  3 ++-
 gnuradio-runtime/lib/basic_block.cc                | 14 +++++++-------
 gnuradio-runtime/lib/block.cc                      |  8 ++++----
 gnuradio-runtime/lib/block_registry.cc             |  7 ++++++-
 4 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/gnuradio-runtime/include/gnuradio/block_registry.h 
b/gnuradio-runtime/include/gnuradio/block_registry.h
index 86e5528..ed19443 100644
--- a/gnuradio-runtime/include/gnuradio/block_registry.h
+++ b/gnuradio-runtime/include/gnuradio/block_registry.h
@@ -65,6 +65,7 @@ namespace gr {
 
 } /* namespace gr */
 
-GR_RUNTIME_API extern gr::block_registry global_block_registry;
+//GR_RUNTIME_API extern gr::block_registry global_block_registry;
+GR_RUNTIME_API extern gr::block_registry* global_block_registry();
 
 #endif /* GR_RUNTIME_BLOCK_REGISTRY_H */
diff --git a/gnuradio-runtime/lib/basic_block.cc 
b/gnuradio-runtime/lib/basic_block.cc
index 082d075..2e699e4 100644
--- a/gnuradio-runtime/lib/basic_block.cc
+++ b/gnuradio-runtime/lib/basic_block.cc
@@ -49,8 +49,8 @@ namespace gr {
       d_input_signature(input_signature),
       d_output_signature(output_signature),
       d_unique_id(s_next_id++),
-      d_symbolic_id(global_block_registry.block_register(this)),
-      d_symbol_name(global_block_registry.register_symbolic_name(this)),
+      d_symbolic_id(global_block_registry()->block_register(this)),
+      d_symbol_name(global_block_registry()->register_symbolic_name(this)),
       d_color(WHITE),
       d_rpc_set(false),
       d_message_subscribers(pmt::make_dict())
@@ -61,7 +61,7 @@ namespace gr {
   basic_block::~basic_block()
   {
     s_ncurrently_allocated--;
-    global_block_registry.block_unregister(this);
+    global_block_registry()->block_unregister(this);
   }
 
   basic_block_sptr
@@ -77,9 +77,9 @@ namespace gr {
     // have an alias, add it; if we do, update the entry in the
     // registry.
     if(alias_set())
-      global_block_registry.update_symbolic_name(this, name);
+      global_block_registry()->update_symbolic_name(this, name);
     else
-      global_block_registry.register_symbolic_name(this, name);
+      global_block_registry()->register_symbolic_name(this, name);
 
     // set the block's alias
     d_symbol_alias = name;
@@ -152,7 +152,7 @@ namespace gr {
       pmt::pmt_t port = pmt::cdr(target);
 
       currlist = pmt::cdr(currlist);
-      basic_block_sptr blk = global_block_registry.block_lookup(block);
+      basic_block_sptr blk = global_block_registry()->block_lookup(block);
       //blk->post(msg);
       blk->post(port, msg);
     }
@@ -209,7 +209,7 @@ namespace gr {
     msg_queue_ready[which_port]->notify_one();
 
     // wake up thread if BLKD_IN or BLKD_OUT
-    global_block_registry.notify_blk(alias());
+    global_block_registry()->notify_blk(alias());
   }
 
   pmt::pmt_t
diff --git a/gnuradio-runtime/lib/block.cc b/gnuradio-runtime/lib/block.cc
index 6edb739..88bac89 100644
--- a/gnuradio-runtime/lib/block.cc
+++ b/gnuradio-runtime/lib/block.cc
@@ -56,7 +56,7 @@ namespace gr {
       d_max_output_buffer(std::max(output_signature->max_streams(),1), -1),
       d_min_output_buffer(std::max(output_signature->max_streams(),1), -1)
   {
-    global_block_registry.register_primitive(alias(), this);
+    global_block_registry()->register_primitive(alias(), this);
     message_port_register_in(pmt::mp("system"));
     set_msg_handler(pmt::mp("system"), boost::bind(&block::system_handler, 
this, _1));
 
@@ -65,7 +65,7 @@ namespace gr {
 
   block::~block()
   {
-    global_block_registry.unregister_primitive(symbol_name());
+    global_block_registry()->unregister_primitive(symbol_name());
   }
 
   unsigned
@@ -708,7 +708,7 @@ namespace gr {
     pmt::pmt_t op = pmt::car(msg);
     if(pmt::eqv(op, pmt::mp("done"))){
         d_finished = pmt::to_long(pmt::cdr(msg));
-        global_block_registry.notify_blk(alias());
+        global_block_registry()->notify_blk(alias());
     } else {
         std::cout << "WARNING: bad message op on system port!\n";
         pmt::print(msg);
@@ -736,7 +736,7 @@ namespace gr {
         pmt::pmt_t port = pmt::mp("system");
 
         currlist = pmt::cdr(currlist);
-        basic_block_sptr blk = global_block_registry.block_lookup(block);
+        basic_block_sptr blk = global_block_registry()->block_lookup(block);
         blk->post(port, pmt::cons(pmt::mp("done"), pmt::mp(true)));
 
         //std::cout << "notify finished --> ";
diff --git a/gnuradio-runtime/lib/block_registry.cc 
b/gnuradio-runtime/lib/block_registry.cc
index 5241ef9..70d7e44 100644
--- a/gnuradio-runtime/lib/block_registry.cc
+++ b/gnuradio-runtime/lib/block_registry.cc
@@ -27,7 +27,12 @@
 #include <gnuradio/tpb_detail.h>
 #include <stdio.h>
 
-gr::block_registry global_block_registry;
+
+gr::block_registry* global_block_registry()
+{
+  static gr::block_registry _global_block_registry;
+  return &_global_block_registry;
+}
 
 namespace gr {
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]