[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 09/12: android: runtime: moved global block
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 09/12: android: runtime: moved global block registry to a static get function. |
Date: |
Fri, 19 Feb 2016 13:58:40 +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 678d0f0f01693ea4f300de24362a0a908fa58884
Author: Tom Rondeau <address@hidden>
Date: Thu Mar 12 10:57:23 2015 -0400
android: runtime: moved global block registry to a static get function.
Convert static vars to static functions.
The static initialized registry alone causes problems with some static
builds, specifically when using controlport.
---
gnuradio-runtime/include/gnuradio/block_registry.h | 3 ++-
gnuradio-runtime/include/gnuradio/rpcregisterhelpers.h | 10 +++++-----
gnuradio-runtime/lib/basic_block.cc | 14 +++++++-------
gnuradio-runtime/lib/block.cc | 8 ++++----
gnuradio-runtime/lib/block_registry.cc | 8 +++++++-
5 files changed, 25 insertions(+), 18 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/include/gnuradio/rpcregisterhelpers.h
b/gnuradio-runtime/include/gnuradio/rpcregisterhelpers.h
index 4405c90..490090d 100644
--- a/gnuradio-runtime/include/gnuradio/rpcregisterhelpers.h
+++ b/gnuradio-runtime/include/gnuradio/rpcregisterhelpers.h
@@ -714,7 +714,7 @@ struct rpcbasic_register_set : public rpcbasic_base
d_desc = desc_;
d_minpriv = minpriv_;
d_display = display_;
- d_object =
dynamic_cast<T*>(global_block_registry.block_lookup(pmt::intern(block_alias)).get());
+ d_object =
dynamic_cast<T*>(global_block_registry()->block_lookup(pmt::intern(block_alias)).get());
#ifdef GR_RPCSERVER_ENABLED
callbackregister_base::configureCallback_t
extractor(new rpcbasic_extractor<T,Tto>(d_object, function),
@@ -872,7 +872,7 @@ struct rpcbasic_register_trigger : public rpcbasic_base
{
d_desc = desc_;
d_minpriv = minpriv_;
- d_object =
dynamic_cast<T*>(global_block_registry.block_lookup(pmt::intern(block_alias)).get());
+ d_object =
dynamic_cast<T*>(global_block_registry()->block_lookup(pmt::intern(block_alias)).get());
#ifdef GR_RPCSERVER_ENABLED
callbackregister_base::configureCallback_t
extractor(new rpcbasic_extractor<T,void>(d_object, function),
@@ -1030,7 +1030,7 @@ public:
d_desc = desc_;
d_minpriv = minpriv_;
d_display = display_;
- d_object =
dynamic_cast<T*>(global_block_registry.block_lookup(pmt::intern(block_alias)).get());
+ d_object =
dynamic_cast<T*>(global_block_registry()->block_lookup(pmt::intern(block_alias)).get());
#ifdef GR_RPCSERVER_ENABLED
callbackregister_base::queryCallback_t
inserter(new rpcbasic_inserter<T,Tfrom>(d_object, function),
@@ -1064,7 +1064,7 @@ public:
d_desc = desc_;
d_minpriv = minpriv_;
d_display = display_;
- d_object =
dynamic_cast<T*>(global_block_registry.block_lookup(pmt::intern(block_alias)).get());
+ d_object =
dynamic_cast<T*>(global_block_registry()->block_lookup(pmt::intern(block_alias)).get());
#ifdef GR_RPCSERVER_ENABLED
callbackregister_base::queryCallback_t
inserter(new rpcbasic_inserter<T,Tfrom>(d_object, (Tfrom
(T::*)())function),
@@ -1434,7 +1434,7 @@ public:
d_desc = desc_;
d_minpriv = minpriv_;
d_display = display_;
- d_object =
dynamic_cast<T*>(global_block_registry.block_lookup(pmt::intern(block_alias)).get());
+ d_object =
dynamic_cast<T*>(global_block_registry()->block_lookup(pmt::intern(block_alias)).get());
#ifdef GR_RPCSERVER_ENABLED
callbackregister_base::handlerCallback_t
inserter(new rpcbasic_handler<T>(d_object, handler),
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 2bae8ea..b164719 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..0f5e905 100644
--- a/gnuradio-runtime/lib/block_registry.cc
+++ b/gnuradio-runtime/lib/block_registry.cc
@@ -27,7 +27,13 @@
#include <gnuradio/tpb_detail.h>
#include <stdio.h>
-gr::block_registry global_block_registry;
+//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 {
- [Commit-gnuradio] [gnuradio] branch android updated (ff27361 -> b7870d6), git, 2016/02/19
- [Commit-gnuradio] [gnuradio] 12/12: analog: add ControlPort interfaces to frequency_modulator block., git, 2016/02/19
- [Commit-gnuradio] [gnuradio] 05/12: android: logger: adding Android log functions for different logging levels., git, 2016/02/19
- [Commit-gnuradio] [gnuradio] 07/12: android: runtime: issues related to vmcircbuf; only mmap_tmpfile version working currently., git, 2016/02/19
- [Commit-gnuradio] [gnuradio] 03/12: android: cmake: changed to using C checks for headers instead of C++., git, 2016/02/19
- [Commit-gnuradio] [gnuradio] 08/12: android: runtime: need to use a usable, writable location for android apps, so use the tmp path that we set up to point to the app's home directory., git, 2016/02/19
- [Commit-gnuradio] [gnuradio] 04/12: android: cmake: adding Boost deps used static builds; ordering in this patch is important., git, 2016/02/19
- [Commit-gnuradio] [gnuradio] 06/12: android: runtime: Android does not support pthread_setaffinity_np; turned this into a nop call., git, 2016/02/19
- [Commit-gnuradio] [gnuradio] 09/12: android: runtime: moved global block registry to a static get function.,
git <=
- [Commit-gnuradio] [gnuradio] 10/12: android: rutnime: better logging and cleanup, git, 2016/02/19
- [Commit-gnuradio] [gnuradio] 11/12: cmake: cmake should get native thrift binary when cross compiling., git, 2016/02/19
- [Commit-gnuradio] [gnuradio] 01/12: android: fft: problems with wisdom files and MEASURE version of FFTW. Using a setting for the FFTW plan options if android or not., git, 2016/02/19
- [Commit-gnuradio] [gnuradio] 02/12: android: cmake: adding toolchain file for building., git, 2016/02/19