commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 28/50: controlport: more cleaning up.


From: git
Subject: [Commit-gnuradio] [gnuradio] 28/50: controlport: more cleaning up.
Date: Wed, 15 Apr 2015 21:07:55 +0000 (UTC)

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

jcorgan pushed a commit to branch master
in repository gnuradio.

commit 075dc8166f7c7462fe5ac830cdccd90df5496a50
Author: Tom Rondeau <address@hidden>
Date:   Tue Mar 3 17:00:48 2015 -0500

    controlport: more cleaning up.
---
 .../include/gnuradio/thrift_application_base.h         | 18 +++++++++++++-----
 .../include/gnuradio/thrift_server_template.h          |  3 ++-
 gr-blocks/python/blocks/qa_ctrlport_probes.py          |  5 ++---
 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 d4a01db..4dc56a1 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 5a81886..ff025b0 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 cb428d6..6bdad7e 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



reply via email to

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