diff options
12 files changed, 206 insertions, 66 deletions
diff --git a/gnuradio-runtime/include/gnuradio/rpcbufferedget.h b/gnuradio-runtime/include/gnuradio/rpcbufferedget.h index ebd740b1f8..ad05551d1a 100644 --- a/gnuradio-runtime/include/gnuradio/rpcbufferedget.h +++ b/gnuradio-runtime/include/gnuradio/rpcbufferedget.h @@ -25,7 +25,6 @@ #include <boost/thread/condition_variable.hpp> #include <boost/thread/mutex.hpp> -#include <stdio.h> template<typename TdataType> class rpcbufferedget { @@ -49,8 +48,8 @@ public: } TdataType get() { - d_data_needed = true; boost::mutex::scoped_lock lock(d_buffer_lock); + d_data_needed = true; d_data_ready.wait(lock); return d_buffer; } diff --git a/gnuradio-runtime/include/gnuradio/rpcserver_booter_thrift.h b/gnuradio-runtime/include/gnuradio/rpcserver_booter_thrift.h index 28900a4670..fd1da09fa6 100644 --- a/gnuradio-runtime/include/gnuradio/rpcserver_booter_thrift.h +++ b/gnuradio-runtime/include/gnuradio/rpcserver_booter_thrift.h @@ -34,8 +34,7 @@ class rpcserver_booter_thrift : public virtual rpcserver_booter_base, public virtual thrift_server_template<rpcserver_base, rpcserver_thrift, - rpcserver_booter_thrift, - boost::shared_ptr<GNURadio::ControlPortIf> > + rpcserver_booter_thrift> { public: rpcserver_booter_thrift(); diff --git a/gnuradio-runtime/include/gnuradio/rpcserver_thrift.h b/gnuradio-runtime/include/gnuradio/rpcserver_thrift.h index 027a9ea75e..203be66e9a 100644 --- a/gnuradio-runtime/include/gnuradio/rpcserver_thrift.h +++ b/gnuradio-runtime/include/gnuradio/rpcserver_thrift.h @@ -32,6 +32,7 @@ #include "thrift/ControlPort.h" #include "thrift/gnuradio_types.h" #include <boost/format.hpp> +#include <boost/thread/mutex.hpp> #define S(x) #x #define S_(x) S(x) @@ -61,6 +62,8 @@ public: virtual void shutdown(); private: + boost::mutex d_callback_map_lock; + typedef std::map<std::string, configureCallback_t> ConfigureCallbackMap_t; ConfigureCallbackMap_t d_setcallbackmap; diff --git a/gnuradio-runtime/include/gnuradio/thrift_application_base.h b/gnuradio-runtime/include/gnuradio/thrift_application_base.h index aa50c55dc8..4af5e8898e 100644 --- a/gnuradio-runtime/include/gnuradio/thrift_application_base.h +++ b/gnuradio-runtime/include/gnuradio/thrift_application_base.h @@ -28,6 +28,7 @@ #include <gnuradio/prefs.h> #include <gnuradio/thread/thread.h> #include <boost/date_time/posix_time/posix_time.hpp> +#include <boost/scoped_ptr.hpp> namespace { // Time, in milliseconds, to wait between checks to the Thrift runtime to see if @@ -83,7 +84,7 @@ public: /*! * Destructor for the application. Since shutdown and cleanup of the * runtime is typically custom to a particular booter - * implementation, this must be implemented as a specalized function + * implementation, this must be implemented as a specialized function * for a particular booter. Thus a template implementation is not * provided here. */ @@ -118,7 +119,7 @@ protected: /*! * Reference to the Thrift runtime. */ - std::auto_ptr<apache::thrift::server::TServer> d_thriftserver; + boost::scoped_ptr<apache::thrift::server::TServer> d_thriftserver; /*! * Max number of attempts when checking the Thrift runtime for @@ -175,7 +176,7 @@ private: // Pointer to the structure containing staticly allocated // state information for the applicaiton_base singleton. - static std::auto_ptr<thrift_application_base_impl > p_impl; + static boost::scoped_ptr<thrift_application_base_impl > p_impl; // Mutex to protect the endpoint string. gr::thread::mutex d_lock; diff --git a/gnuradio-runtime/include/gnuradio/thrift_server_template.h b/gnuradio-runtime/include/gnuradio/thrift_server_template.h index 1e9059d920..b8f5448fdc 100644 --- a/gnuradio-runtime/include/gnuradio/thrift_server_template.h +++ b/gnuradio-runtime/include/gnuradio/thrift_server_template.h @@ -39,7 +39,7 @@ using namespace apache; -template<typename TserverBase, typename TserverClass, typename TImplClass, typename TThriftClass> +template<typename TserverBase, typename TserverClass, typename TImplClass> class thrift_server_template : public thrift_application_base<TserverBase, TImplClass> { public: @@ -50,9 +50,12 @@ protected: TserverBase* i_impl(); friend class thrift_application_base<TserverBase, TImplClass>; - TserverBase* d_server; - private: + boost::shared_ptr<TserverClass> d_handler; + boost::shared_ptr<thrift::TProcessor> d_processor; + boost::shared_ptr<thrift::transport::TServerTransport> d_serverTransport; + boost::shared_ptr<thrift::transport::TTransportFactory> d_transportFactory; + boost::shared_ptr<thrift::protocol::TProtocolFactory> d_protocolFactory; /** * Custom TransportFactory that allows you to override the default Thrift buffer size * of 512 bytes. @@ -76,9 +79,14 @@ private: }; }; -template<typename TserverBase, typename TserverClass, typename TImplClass, typename TThriftClass> -thrift_server_template<TserverBase, TserverClass, TImplClass, TThriftClass>::thrift_server_template -(TImplClass* _this) : thrift_application_base<TserverBase, TImplClass>(_this) +template<typename TserverBase, typename TserverClass, typename TImplClass> +thrift_server_template<TserverBase, TserverClass, TImplClass>::thrift_server_template +(TImplClass* _this) : thrift_application_base<TserverBase, TImplClass>(_this), +d_handler(new TserverClass()), +d_processor(new GNURadio::ControlPortProcessor(d_handler)), +d_serverTransport(), +d_transportFactory(), +d_protocolFactory(new thrift::protocol::TBinaryProtocolFactory()) { gr::logger_ptr logger, debug_logger; gr::configure_default_loggers(logger, debug_logger, "controlport"); @@ -87,74 +95,59 @@ thrift_server_template<TserverBase, TserverClass, TImplClass, TThriftClass>::thr std::string thrift_config_file = gr::prefs::singleton()->get_string("ControlPort", "config", ""); if(thrift_config_file.length() > 0) { - gr::prefs::singleton()->add_config_file(thrift_config_file); + gr::prefs::singleton()->add_config_file(thrift_config_file); } // Collect configuration options from the Thrift config file; // defaults if the config file doesn't exist or list the specific // options. port = static_cast<unsigned int>(gr::prefs::singleton()->get_long("thrift", "port", - thrift_application_base<TserverBase, TImplClass>::d_default_thrift_port)); + thrift_application_base<TserverBase, TImplClass>::d_default_thrift_port)); nthreads = static_cast<unsigned int>(gr::prefs::singleton()->get_long("thrift", "nthreads", - thrift_application_base<TserverBase, TImplClass>::d_default_num_thrift_threads)); + thrift_application_base<TserverBase, TImplClass>::d_default_num_thrift_threads)); buffersize = static_cast<unsigned int>(gr::prefs::singleton()->get_long("thrift", "buffersize", - thrift_application_base<TserverBase, TImplClass>::d_default_thrift_buffer_size)); - - boost::shared_ptr<TserverClass> handler(new TserverClass()); - - boost::shared_ptr<thrift::TProcessor> - processor(new GNURadio::ControlPortProcessor(handler)); + thrift_application_base<TserverBase, TImplClass>::d_default_thrift_buffer_size)); - boost::shared_ptr<thrift::transport::TServerTransport> - serverTransport(new thrift::transport::TServerSocket(port)); + d_serverTransport.reset(new thrift::transport::TServerSocket(port)); - boost::shared_ptr<thrift::transport::TTransportFactory> - transportFactory(new thrift_server_template::TBufferedTransportFactory(buffersize)); - - boost::shared_ptr<thrift::protocol::TProtocolFactory> - protocolFactory(new thrift::protocol::TBinaryProtocolFactory()); + d_transportFactory.reset(new thrift_server_template::TBufferedTransportFactory(buffersize)); if(nthreads <= 1) { - // "Thrift: Single-threaded server" - //std::cout << "Thrift Single-threaded server" << std::endl; - thrift_application_base<TserverBase, TImplClass>::d_thriftserver.reset( - new thrift::server::TSimpleServer(processor, serverTransport, - transportFactory, protocolFactory)); + // "Thrift: Single-threaded server" + //std::cout << "Thrift Single-threaded server" << std::endl; + thrift_application_base<TserverBase, TImplClass>::d_thriftserver.reset( + new thrift::server::TSimpleServer(d_processor, d_serverTransport, d_transportFactory, d_protocolFactory)); } else { - //std::cout << "Thrift Multi-threaded server : " << nthreads << std::endl; - boost::shared_ptr<thrift::concurrency::ThreadManager> threadManager - (thrift::concurrency::ThreadManager::newSimpleThreadManager(nthreads)); - - boost::shared_ptr<thrift::concurrency::PlatformThreadFactory> threadFactory - (boost::shared_ptr<thrift::concurrency::PlatformThreadFactory> - (new thrift::concurrency::PlatformThreadFactory())); + //std::cout << "Thrift Multi-threaded server : " << d_nthreads << std::endl; + boost::shared_ptr<thrift::concurrency::ThreadManager> threadManager( + thrift::concurrency::ThreadManager::newSimpleThreadManager(nthreads)); - threadManager->threadFactory(threadFactory); + threadManager->threadFactory( + boost::shared_ptr<thrift::concurrency::PlatformThreadFactory>( + new thrift::concurrency::PlatformThreadFactory())); - threadManager->start(); + threadManager->start(); - thrift_application_base<TserverBase, TImplClass>::d_thriftserver.reset( - new thrift::server::TThreadPoolServer(processor, serverTransport, - transportFactory, protocolFactory, - threadManager)); + thrift_application_base<TserverBase, TImplClass>::d_thriftserver.reset( + new thrift::server::TThreadPoolServer(d_processor, d_serverTransport, + d_transportFactory, d_protocolFactory, + threadManager)); } - - d_server = handler.get(); } -template<typename TserverBase, typename TserverClass, typename TImplClass, typename TThriftClass> -thrift_server_template<TserverBase, TserverClass,TImplClass, TThriftClass>::~thrift_server_template() +template<typename TserverBase, typename TserverClass, typename TImplClass> +thrift_server_template<TserverBase, TserverClass,TImplClass>::~thrift_server_template() { } -template<typename TserverBase, typename TserverClass, typename TImplClass, typename TThriftClass> -TserverBase* thrift_server_template<TserverBase, TserverClass, TImplClass, TThriftClass>::i_impl() +template<typename TserverBase, typename TserverClass, typename TImplClass> +TserverBase* thrift_server_template<TserverBase, TserverClass, TImplClass>::i_impl() { //std::cerr << "thrift_server_template: i_impl" << std::endl; - return d_server; + return d_handler.get(); } #endif /* THRIFT_SERVER_TEMPLATE_H */ diff --git a/gnuradio-runtime/lib/controlport/thrift/README b/gnuradio-runtime/lib/controlport/thrift/README new file mode 100644 index 0000000000..5448e512f7 --- /dev/null +++ b/gnuradio-runtime/lib/controlport/thrift/README @@ -0,0 +1,41 @@ +For info on ControlPort and Thrift, see the wiki page: + +http://gnuradio.org/redmine/projects/gnuradio/wiki/ControlPort + +This readme is to address the patch file in the repo for Thrift. We +believe that there is a bug in Thrift itself that occasionally causes +a segfault when shutting down the server. If you run into a problem +when shutting down an application running ControlPort, this might be +the cause. If so, we have included a patch with the source code in +this directory that should be applied to Thrift before rebuilding the +Thrift library: + +thrift-codebase-shutdown-patch.diff + +Note that we are working off Thrift version 0.9.2, so this patch may +not be relevant or even cleanly apply in later versions of Thrift. + +We are also still trying to track down another shutdown problem with +Thrift that again appears to be related to their code. If a segfault +persists after the above patch is applied to Thrift, do a backtrace in +GDB to see what the error looks like. If it is different than the +following backtrace, definitely report it to the Discuss GNU Radio +Mailing List as a known bug. If you see the same backtrace as here, +this is a known bug that occurs very irregularly, but help in tracing +down the cause is appreciated. + +#0 0x00007f07b5b478c2 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 +(gdb) bt +#0 0x00007f07b5b478c2 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 +#1 0x00007f07b5b4856d in ?? () from /lib/x86_64-linux-gnu/libc.so.6 +#2 0x00007f07afc924c5 in std::locale::_Impl::~_Impl() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 +#3 0x00007f07afc925fd in std::locale::~locale() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 +#4 0x00007f07b5b05259 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 +#5 0x00007f07b5b052a5 in exit () from /lib/x86_64-linux-gnu/libc.so.6 +#6 0x000000000042fb83 in Py_Exit () +#7 0x000000000042fcb9 in ?? () +#8 0x000000000042ec32 in PyErr_PrintEx () +#9 0x0000000000469f2f in PyRun_SimpleFileExFlags () +#10 0x000000000046ab81 in Py_Main () +#11 0x00007f07b5aeaec5 in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6 +#12 0x000000000057497e in _start () diff --git a/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc b/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc index 40cfe1a48a..1d6cafe0c0 100644 --- a/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc +++ b/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc @@ -42,8 +42,7 @@ namespace { rpcserver_booter_thrift::rpcserver_booter_thrift() : thrift_server_template<rpcserver_base, rpcserver_thrift, - rpcserver_booter_thrift, - boost::shared_ptr<GNURadio::ControlPortIf> >(this), + rpcserver_booter_thrift>(this), d_type(std::string(CONTROL_PORT_CLASS)) {;} @@ -54,8 +53,7 @@ rpcserver_base* rpcserver_booter_thrift::i() { return thrift_server_template<rpcserver_base, rpcserver_thrift, - rpcserver_booter_thrift, - GNURadio::ControlPortIf>::i(); + rpcserver_booter_thrift>::i(); } /*! @@ -66,8 +64,7 @@ const std::vector<std::string> rpcserver_booter_thrift::endpoints() { return thrift_server_template<rpcserver_base, rpcserver_thrift, - rpcserver_booter_thrift, - GNURadio::ControlPortIf>::endpoints(); + rpcserver_booter_thrift>::endpoints(); } // Specialized thrift_application_base attributes and functions @@ -87,14 +84,13 @@ const unsigned int thrift_application_base<rpcserver_base, rpcserver_booter_thri ALRIGHT_DEFAULT_BUFFER_SIZE); template<class rpcserver_base, class rpcserver_booter_thrift> -std::auto_ptr<thrift_application_base_impl> +boost::scoped_ptr<thrift_application_base_impl> thrift_application_base<rpcserver_base, rpcserver_booter_thrift>::p_impl( new thrift_application_base_impl()); template<class rpcserver_base, class rpcserver_booter_thrift> thrift_application_base<rpcserver_base, rpcserver_booter_thrift>::~thrift_application_base() { - GR_LOG_DEBUG(d_debug_logger, "thrift_application_base: shutdown"); if(d_thirft_is_running) { d_thriftserver->stop(); d_thirft_is_running = false; @@ -125,7 +121,7 @@ bool thrift_application_base<rpcserver_base, rpcserver_booter_thrift>::applicati const std::string boost_hostname(boost::asio::ip::host_name()); std::string endpoint = boost::str(boost::format("-h %1% -p %2%") % boost_hostname % used_port); - //std::cout << "Thrift endpoint: " << endpoint << " boost hostname: " << boost_hostname << std::endl; + set_endpoint(endpoint); GR_LOG_INFO(d_logger, "Apache Thrift: " + endpoint); diff --git a/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc b/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc index c4655d366e..3e6eabc854 100644 --- a/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc +++ b/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc @@ -49,6 +49,7 @@ void rpcserver_thrift::registerConfigureCallback(const std::string &id, const configureCallback_t callback) { + boost::mutex::scoped_lock lock(d_callback_map_lock); { ConfigureCallbackMap_t::const_iterator iter(d_setcallbackmap.find(id)); if(iter != d_setcallbackmap.end()) { @@ -68,6 +69,7 @@ rpcserver_thrift::registerConfigureCallback(const std::string &id, void rpcserver_thrift::unregisterConfigureCallback(const std::string &id) { + boost::mutex::scoped_lock lock(d_callback_map_lock); ConfigureCallbackMap_t::iterator iter(d_setcallbackmap.find(id)); if(iter == d_setcallbackmap.end()) { std::stringstream s; @@ -86,6 +88,7 @@ void rpcserver_thrift::registerQueryCallback(const std::string &id, const queryCallback_t callback) { + boost::mutex::scoped_lock lock(d_callback_map_lock); { QueryCallbackMap_t::const_iterator iter(d_getcallbackmap.find(id)); if(iter != d_getcallbackmap.end()) { @@ -105,6 +108,7 @@ rpcserver_thrift::registerQueryCallback(const std::string &id, void rpcserver_thrift::unregisterQueryCallback(const std::string &id) { + boost::mutex::scoped_lock lock(d_callback_map_lock); QueryCallbackMap_t::iterator iter(d_getcallbackmap.find(id)); if(iter == d_getcallbackmap.end()) { std::stringstream s; @@ -123,6 +127,7 @@ rpcserver_thrift::unregisterQueryCallback(const std::string &id) void rpcserver_thrift::setKnobs(const GNURadio::KnobMap& knobs) { + boost::mutex::scoped_lock lock(d_callback_map_lock); std::for_each(knobs.begin(), knobs.end(), set_f<GNURadio::KnobMap::value_type,ConfigureCallbackMap_t> (d_setcallbackmap, cur_priv)); @@ -133,6 +138,7 @@ void rpcserver_thrift::getKnobs(GNURadio::KnobMap& _return, const GNURadio::KnobIDList& knobs) { + boost::mutex::scoped_lock lock(d_callback_map_lock); if(knobs.size() == 0) { std::for_each(d_getcallbackmap.begin(), d_getcallbackmap.end(), get_all_f<QueryCallbackMap_t::value_type, QueryCallbackMap_t, GNURadio::KnobMap> @@ -148,6 +154,7 @@ rpcserver_thrift::getKnobs(GNURadio::KnobMap& _return, void rpcserver_thrift::getRe(GNURadio::KnobMap& _return, const GNURadio::KnobIDList& knobs) { + boost::mutex::scoped_lock lock(d_callback_map_lock); if(knobs.size() == 0) { std::for_each(d_getcallbackmap.begin(), d_getcallbackmap.end(), get_all_f<QueryCallbackMap_t::value_type, QueryCallbackMap_t, GNURadio::KnobMap> @@ -172,6 +179,7 @@ void rpcserver_thrift::properties(GNURadio::KnobPropMap& _return, const GNURadio::KnobIDList& knobs) { + boost::mutex::scoped_lock lock(d_callback_map_lock); if(knobs.size() == 0) { std::for_each(d_getcallbackmap.begin(), d_getcallbackmap.end(), properties_all_f<QueryCallbackMap_t::value_type, diff --git a/gnuradio-runtime/lib/controlport/thrift/thrift-codebase-shutdown-patch.diff b/gnuradio-runtime/lib/controlport/thrift/thrift-codebase-shutdown-patch.diff new file mode 100644 index 0000000000..eaf54d5c70 --- /dev/null +++ b/gnuradio-runtime/lib/controlport/thrift/thrift-codebase-shutdown-patch.diff @@ -0,0 +1,98 @@ +diff --git a/lib/cpp/src/thrift/concurrency/ThreadManager.cpp b/lib/cpp/src/thrift/concurrency/ThreadManager.cpp +index 255d237..9954a8a 100644 +--- a/lib/cpp/src/thrift/concurrency/ThreadManager.cpp ++++ b/lib/cpp/src/thrift/concurrency/ThreadManager.cpp +@@ -409,6 +409,8 @@ void ThreadManager::Impl::removeWorker(size_t value) { + + workerMaxCount_ -= value; + ++ shutdown_mutex_.unlock(); ++ + if (idleCount_ < value) { + for (size_t ix = 0; ix < idleCount_; ix++) { + monitor_.notify(); +diff --git a/lib/cpp/src/thrift/concurrency/ThreadManager.h b/lib/cpp/src/thrift/concurrency/ThreadManager.h +index 7bb71d1..e97fd25 100644 +--- a/lib/cpp/src/thrift/concurrency/ThreadManager.h ++++ b/lib/cpp/src/thrift/concurrency/ThreadManager.h +@@ -24,6 +24,7 @@ + #include <thrift/cxxfunctional.h> + #include <sys/types.h> + #include <thrift/concurrency/Thread.h> ++#include <thrift/concurrency/Mutex.h> + + namespace apache { + namespace thrift { +@@ -59,6 +60,7 @@ protected: + ThreadManager() {} + + public: ++ Mutex shutdown_mutex_; + typedef apache::thrift::stdcxx::function<void(boost::shared_ptr<Runnable>)> ExpireCallback; + + virtual ~ThreadManager() {} +diff --git a/lib/cpp/src/thrift/server/TThreadPoolServer.cpp b/lib/cpp/src/thrift/server/TThreadPoolServer.cpp +index 0530d8d..d6b73dc 100644 +--- a/lib/cpp/src/thrift/server/TThreadPoolServer.cpp ++++ b/lib/cpp/src/thrift/server/TThreadPoolServer.cpp +@@ -194,19 +194,28 @@ void TThreadPoolServer::serve() { + } + } + +- // If stopped manually, join the existing threads +- if (stop_) { +- try { +- serverTransport_->close(); +- threadManager_->join(); +- } catch (TException& tx) { +- string errStr = string("TThreadPoolServer: Exception shutting down: ") + tx.what(); +- GlobalOutput(errStr.c_str()); ++ { ++ Guard g(threadManager_->shutdown_mutex_); ++ // If stopped manually, join the existing threads ++ if (stop_) { ++ try { ++ serverTransport_->close(); ++ threadManager_->join(); ++ } catch (TException& tx) { ++ string errStr = string("TThreadPoolServer: Exception shutting down: ") + tx.what(); ++ GlobalOutput(errStr.c_str()); ++ } ++ stop_ = false; + } +- stop_ = false; + } + } + ++void TThreadPoolServer::stop() { ++ threadManager_->shutdown_mutex_.lock(); ++ stop_ = true; ++ serverTransport_->interrupt(); ++} ++ + int64_t TThreadPoolServer::getTimeout() const { + return timeout_; + } +diff --git a/lib/cpp/src/thrift/server/TThreadPoolServer.h b/lib/cpp/src/thrift/server/TThreadPoolServer.h +index ad7e7ef..9b89846 100644 +--- a/lib/cpp/src/thrift/server/TThreadPoolServer.h ++++ b/lib/cpp/src/thrift/server/TThreadPoolServer.h +@@ -24,6 +24,7 @@ + #include <thrift/server/TServer.h> + #include <thrift/transport/TServerTransport.h> + ++ + #include <boost/shared_ptr.hpp> + + namespace apache { +@@ -113,10 +114,7 @@ public: + + virtual void setTimeout(int64_t value); + +- virtual void stop() { +- stop_ = true; +- serverTransport_->interrupt(); +- } ++ virtual void stop(); + + virtual int64_t getTaskExpiration() const; diff --git a/gnuradio-runtime/lib/pmt/unv_template.cc.t b/gnuradio-runtime/lib/pmt/unv_template.cc.t index d3fa14bee1..c9402de19d 100644 --- a/gnuradio-runtime/lib/pmt/unv_template.cc.t +++ b/gnuradio-runtime/lib/pmt/unv_template.cc.t @@ -21,8 +21,7 @@ pmt_@TAG@vector::pmt_@TAG@vector(size_t k, @TYPE@ fill) pmt_@TAG@vector::pmt_@TAG@vector(size_t k, const @TYPE@ *data) : d_v(k) { - for (size_t i = 0; i < k; i++) - d_v[i] = data[i]; + memcpy( &d_v[0], data, k * sizeof(@TYPE@) ); } @TYPE@ diff --git a/gr-blocks/lib/message_strobe_impl.cc b/gr-blocks/lib/message_strobe_impl.cc index ae13808674..d12e0ebd4d 100644 --- a/gr-blocks/lib/message_strobe_impl.cc +++ b/gr-blocks/lib/message_strobe_impl.cc @@ -67,6 +67,9 @@ namespace gr { bool message_strobe_impl::start() { + // NOTE: d_finished should be something explicitely thread safe. But since + // nothing breaks on concurrent access, I'll just leave it as bool. + d_finished = false; d_thread = boost::shared_ptr<gr::thread::thread> (new gr::thread::thread(boost::bind(&message_strobe_impl::run, this))); diff --git a/gr-uhd/lib/usrp_sink_impl.cc b/gr-uhd/lib/usrp_sink_impl.cc index 60f0a3997e..08896a8bb0 100644 --- a/gr-uhd/lib/usrp_sink_impl.cc +++ b/gr-uhd/lib/usrp_sink_impl.cc @@ -809,7 +809,7 @@ namespace gr { _metadata.time_spec = _start_time; } else { - _metadata.time_spec = get_time_now() + ::uhd::time_spec_t(0.01); + _metadata.time_spec = get_time_now() + ::uhd::time_spec_t(0.15); } #ifdef GR_UHD_USE_STREAM_API |