summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2015-03-03 17:00:48 -0500
committerTom Rondeau <tom@trondeau.com>2015-04-02 15:38:57 -0700
commit075dc8166f7c7462fe5ac830cdccd90df5496a50 (patch)
tree7aee210b683a47e1c383f8c80b03267fe10bf4b3
parent3da7369d88f67258d1ed69069521a2620657b875 (diff)
controlport: more cleaning up.
-rw-r--r--gnuradio-runtime/include/gnuradio/thrift_application_base.h18
-rw-r--r--gnuradio-runtime/include/gnuradio/thrift_server_template.h3
-rw-r--r--gr-blocks/python/blocks/qa_ctrlport_probes.py5
3 files changed, 17 insertions, 9 deletions
diff --git a/gnuradio-runtime/include/gnuradio/thrift_application_base.h b/gnuradio-runtime/include/gnuradio/thrift_application_base.h
index d4a01db585..4dc56a1f4c 100644
--- a/gnuradio-runtime/include/gnuradio/thrift_application_base.h
+++ b/gnuradio-runtime/include/gnuradio/thrift_application_base.h
@@ -25,7 +25,7 @@
#include <gnuradio/api.h>
#include <gnuradio/logger.h>
-#include <boost/thread.hpp>
+#include <gnuradio/thread/thread.h>
namespace {
static const unsigned int THRIFTAPPLICATION_ACTIVATION_TIMEOUT_MS(600);
@@ -45,7 +45,7 @@ class GR_RUNTIME_API thrift_application_common
static bool d_main_called;
static bool d_have_thrift_config;
static std::string d_endpointStr;
- static boost::shared_ptr<boost::thread> d_thread;
+ static boost::shared_ptr<gr::thread::thread> d_thread;
apache::thrift::server::TServer* d_thriftserver;
@@ -67,7 +67,7 @@ public:
protected:
bool have_thrift_config() { return d_application->d_have_thrift_config; }
- void set_endpoint(const std::string& endpoint) { d_application->d_endpointStr = endpoint;}
+ void set_endpoint(const std::string& endpoint);
//this one is the key... overwrite in templated/inherited variants
virtual TserverBase* i_impl() = 0;
@@ -82,6 +82,8 @@ protected:
gr::logger_ptr d_logger, d_debug_logger;
private:
+ gr::thread::mutex d_lock;
+
bool d_is_running;
void start_thrift();
@@ -118,8 +120,8 @@ void thrift_application_base<TserverBase, TserverClass>::kickoff()
static bool run_once = false;
if(!run_once) {
- thrift_application_common::d_thread = boost::shared_ptr<boost::thread>
- (new boost::thread(boost::bind(&thrift_application_base::start_thrift, d_this)));
+ thrift_application_common::d_thread = boost::shared_ptr<gr::thread::thread>
+ (new gr::thread::thread(boost::bind(&thrift_application_base::start_thrift, d_this)));
run_once = true;
}
@@ -136,6 +138,12 @@ const std::vector<std::string> thrift_application_base<TserverBase, TserverClass
return ep;
}
+template<typename TserverBase, typename TserverClass>
+void thrift_application_base<TserverBase, TserverClass>::set_endpoint(const std::string& endpoint)
+{
+ gr::thread::scoped_lock guard(d_lock);
+ d_application->d_endpointStr = endpoint;
+}
template<typename TserverBase, typename TserverClass>
TserverBase* thrift_application_base<TserverBase, TserverClass>::i()
diff --git a/gnuradio-runtime/include/gnuradio/thrift_server_template.h b/gnuradio-runtime/include/gnuradio/thrift_server_template.h
index 5a81886343..ff025b080c 100644
--- a/gnuradio-runtime/include/gnuradio/thrift_server_template.h
+++ b/gnuradio-runtime/include/gnuradio/thrift_server_template.h
@@ -131,12 +131,13 @@ thrift_server_template<TserverBase, TserverClass, TImplClass, TThriftClass>::thr
if(nthreads <= 1) {
// "Thrift: Single-threaded server"
+ //std::cout << "Thrift Single-threaded server" << std::endl;
thrift_application_base<TserverBase, TImplClass>::d_thriftserver =
new thrift::server::TSimpleServer(processor, serverTransport,
transportFactory, protocolFactory);
}
else {
- // std::cout << "Thrift Multi-threaded server : " << nthreads << std::endl;
+ //std::cout << "Thrift Multi-threaded server : " << nthreads << std::endl;
boost::shared_ptr<thrift::concurrency::ThreadManager> threadManager
(thrift::concurrency::ThreadManager::newSimpleThreadManager(nthreads));
diff --git a/gr-blocks/python/blocks/qa_ctrlport_probes.py b/gr-blocks/python/blocks/qa_ctrlport_probes.py
index cb428d6dda..6bdad7ec3b 100644
--- a/gr-blocks/python/blocks/qa_ctrlport_probes.py
+++ b/gr-blocks/python/blocks/qa_ctrlport_probes.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2013 Free Software Foundation, Inc.
+# Copyright 2013,2015 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,14 +24,13 @@ import sys, time, random, numpy
from gnuradio import gr, gr_unittest, blocks
import os, struct
-#from gnuradio import ctrlport
from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient
class test_ctrlport_probes(gr_unittest.TestCase):
def setUp(self):
- self.tb = gr.top_block()
os.environ['GR_CONF_CONTROLPORT_ON'] = 'True'
+ self.tb = gr.top_block()
def tearDown(self):
self.tb = None