diff options
Diffstat (limited to 'gnuradio-runtime/lib')
-rw-r--r-- | gnuradio-runtime/lib/constants.cc.in | 19 | ||||
-rw-r--r-- | gnuradio-runtime/lib/controlport/rpcmanager.cc | 5 | ||||
-rw-r--r-- | gnuradio-runtime/lib/controlport/rpcserver_selector.cc | 4 | ||||
-rw-r--r-- | gnuradio-runtime/lib/flat_flowgraph.cc | 9 | ||||
-rw-r--r-- | gnuradio-runtime/lib/pmt/pmt.cc | 12 | ||||
-rw-r--r-- | gnuradio-runtime/lib/top_block.cc | 19 |
6 files changed, 54 insertions, 14 deletions
diff --git a/gnuradio-runtime/lib/constants.cc.in b/gnuradio-runtime/lib/constants.cc.in index 516e2f8798..b368e9dc3f 100644 --- a/gnuradio-runtime/lib/constants.cc.in +++ b/gnuradio-runtime/lib/constants.cc.in @@ -24,6 +24,7 @@ #include <config.h> #endif +#include <stdlib.h> #include <gnuradio/constants.h> namespace gr { @@ -31,18 +32,36 @@ namespace gr { const std::string prefix() { + //Use "GR_PREFIX" environment variable when specified + const char *prefix = getenv("GR_PREFIX"); + if (prefix != NULL) return prefix; + return "@prefix@"; } const std::string sysconfdir() { + //Provide the sysconfdir in terms of prefix() + //when the "GR_PREFIX" environment var is specified. + if (getenv("GR_PREFIX") != NULL) + { + return prefix() + "/@GR_CONF_DIR@"; + } + return "@SYSCONFDIR@"; } const std::string prefsdir() { + //Provide the prefsdir in terms of sysconfdir() + //when the "GR_PREFIX" environment var is specified. + if (getenv("GR_PREFIX") != NULL) + { + return sysconfdir() + "/@CMAKE_PROJECT_NAME@/conf.d"; + } + return "@GR_PREFSDIR@"; } diff --git a/gnuradio-runtime/lib/controlport/rpcmanager.cc b/gnuradio-runtime/lib/controlport/rpcmanager.cc index a67febe386..fee255498e 100644 --- a/gnuradio-runtime/lib/controlport/rpcmanager.cc +++ b/gnuradio-runtime/lib/controlport/rpcmanager.cc @@ -24,11 +24,6 @@ #include <iostream> #include <stdexcept> -bool rpcmanager::booter_registered(false); -bool rpcmanager::aggregator_registered(false); -std::auto_ptr<rpcserver_booter_base> rpcmanager::boot(0); -std::auto_ptr<rpcserver_booter_aggregator> rpcmanager::aggregator(0); - rpcmanager::rpcmanager() {;} rpcmanager::~rpcmanager() {;} diff --git a/gnuradio-runtime/lib/controlport/rpcserver_selector.cc b/gnuradio-runtime/lib/controlport/rpcserver_selector.cc index 8f3b4557c2..fcba1ab524 100644 --- a/gnuradio-runtime/lib/controlport/rpcserver_selector.cc +++ b/gnuradio-runtime/lib/controlport/rpcserver_selector.cc @@ -25,6 +25,10 @@ #include <gnuradio/rpcserver_selector.h> bool rpcmanager::make_aggregator(false); +bool rpcmanager::booter_registered(false); +bool rpcmanager::aggregator_registered(false); +std::auto_ptr<rpcserver_booter_base> rpcmanager::boot(0); +std::auto_ptr<rpcserver_booter_aggregator> rpcmanager::aggregator(0); #ifdef GR_RPCSERVER_ENABLED rpcmanager manager_instance; diff --git a/gnuradio-runtime/lib/flat_flowgraph.cc b/gnuradio-runtime/lib/flat_flowgraph.cc index 434a92fb3d..b7e949127a 100644 --- a/gnuradio-runtime/lib/flat_flowgraph.cc +++ b/gnuradio-runtime/lib/flat_flowgraph.cc @@ -316,6 +316,15 @@ namespace gr { setup_buffer_alignment(block); } + // Connect message ports connetions + for(msg_edge_viter_t i = d_msg_edges.begin(); i != d_msg_edges.end(); i++) { + if(FLAT_FLOWGRAPH_DEBUG) + std::cout << boost::format("flat_fg connecting msg primitives: (%s, %s)->(%s, %s)\n") % + i->src().block() % i->src().port() % + i->dst().block() % i->dst().port(); + i->src().block()->message_port_sub(i->src().port(), pmt::cons(i->dst().block()->alias_pmt(), i->dst().port())); + } + // Now deal with the fact that the block details might have // changed numbers of inputs and outputs vs. in the old // flowgraph. diff --git a/gnuradio-runtime/lib/pmt/pmt.cc b/gnuradio-runtime/lib/pmt/pmt.cc index 51fb86e58c..e09452e60e 100644 --- a/gnuradio-runtime/lib/pmt/pmt.cc +++ b/gnuradio-runtime/lib/pmt/pmt.cc @@ -281,7 +281,17 @@ string_to_symbol(const std::string &name) if (name == _symbol(sym)->name()) return sym; // Yes. Return it } - + + // Lock the table on insert for thread safety: + static boost::mutex thread_safety; + boost::mutex::scoped_lock lock(thread_safety); + // Re-do the search in case another thread inserted this symbol into the table + // before we got the lock + for (pmt_t sym = (*get_symbol_hash_table())[hash]; sym; sym = _symbol(sym)->next()){ + if (name == _symbol(sym)->name()) + return sym; // Yes. Return it + } + // Nope. Make a new one. pmt_t sym = pmt_t(new pmt_symbol(name)); _symbol(sym)->set_next((*get_symbol_hash_table())[hash]); diff --git a/gnuradio-runtime/lib/top_block.cc b/gnuradio-runtime/lib/top_block.cc index 8918a8f12d..7d135083dd 100644 --- a/gnuradio-runtime/lib/top_block.cc +++ b/gnuradio-runtime/lib/top_block.cc @@ -59,6 +59,17 @@ namespace gr { void top_block::start(int max_noutput_items) { +#ifdef GNURADIO_HRT_USE_CLOCK_GETTIME + std::string initial_clock = prefs::singleton()->get_string("PerfCounters", "clock", "thread"); + if(initial_clock.compare("thread") == 0){ + gr::high_res_timer_source = CLOCK_THREAD_CPUTIME_ID; + } else if(initial_clock.compare("monotonic") == 0){ + gr::high_res_timer_source = CLOCK_MONOTONIC; + } else { + throw std::runtime_error("bad argument for PerfCounters.clock!"); + } +#endif + d_impl->start(max_noutput_items); if(prefs::singleton()->get_bool("ControlPort", "on", false)) { @@ -186,14 +197,6 @@ namespace gr { } #ifdef GNURADIO_HRT_USE_CLOCK_GETTIME - std::string initial_clock = prefs::singleton()->get_string("PerfCounters", "clock", "thread"); - if(initial_clock.compare("thread") == 0){ - gr::high_res_timer_source = CLOCK_THREAD_CPUTIME_ID; - } else if(initial_clock.compare("monotonic") == 0){ - gr::high_res_timer_source = CLOCK_MONOTONIC; - } else { - throw std::runtime_error("bad argument for PerfCounters.clock!"); - } add_rpc_variable( rpcbasic_sptr(new rpcbasic_register_variable_rw<int>( alias(), "perfcounter_clock", |