move BaseUI::_name into EventLoop; rename access method in EventLoop as event_loop_na...
authorPaul Davis <paul@linuxaudiosystems.com>
Sat, 12 Dec 2015 15:55:40 +0000 (10:55 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Sat, 12 Dec 2015 16:12:10 +0000 (11:12 -0500)
libs/pbd/base_ui.cc
libs/pbd/event_loop.cc
libs/pbd/pbd/base_ui.h
libs/pbd/pbd/event_loop.h

index 09dfa74785c303c1723c3203303c2e2d80bf68f1..c56fb8f4fe33eeaa1a5fe15fbcb0f259a858ca15 100644 (file)
@@ -47,10 +47,10 @@ uint64_t BaseUI::rt_bit = 1;
 BaseUI::RequestType BaseUI::CallSlot = BaseUI::new_request_type();
 BaseUI::RequestType BaseUI::Quit = BaseUI::new_request_type();
 
-BaseUI::BaseUI (const string& str)
-       : m_context(MainContext::get_default())
+BaseUI::BaseUI (const string& loop_name)
+       : EventLoop (loop_name)
+       , m_context(MainContext::get_default())
        , run_loop_thread (0)
-       , _name (str)
        , request_channel (true)
 {
        base_ui_instance = this;
@@ -79,7 +79,7 @@ BaseUI::new_request_type ()
 void
 BaseUI::main_thread ()
 {
-       DEBUG_TRACE (DEBUG::EventLoop, string_compose ("%1: event loop running in thread %2\n", name(), pthread_name()));
+       DEBUG_TRACE (DEBUG::EventLoop, string_compose ("%1: event loop running in thread %2\n", event_loop_name(), pthread_name()));
        set_event_loop_for_thread (this);
        thread_init ();
        _main_loop->get_context()->signal_idle().connect (sigc::mem_fun (*this, &BaseUI::signal_running));
index d3f2fe50388b6fb6a52b1aa704ebf19561220d26..95b43d9038e2deb78cf965a727d57b44474f6f50 100644 (file)
@@ -27,6 +27,11 @@ static void do_not_delete_the_loop_pointer (void*) { }
 
 Glib::Threads::Private<EventLoop> EventLoop::thread_event_loop (do_not_delete_the_loop_pointer);
 
+EventLoop::EventLoop (string const& name)
+       : _name (name)
+{
+}
+
 EventLoop*
 EventLoop::get_event_loop_for_thread() {
        return thread_event_loop.get ();
index ec2cf336785af2dcee2d45f66dacbe13c52580f8..029d8223eaaa0d1692bb75d136b93f061d5ae54f 100644 (file)
@@ -54,8 +54,6 @@ class LIBPBD_API BaseUI : public sigc::trackable, public PBD::EventLoop
         Glib::Threads::Thread* event_loop_thread() const { return run_loop_thread; }
         bool caller_is_self () const { return Glib::Threads::Thread::self() == run_loop_thread; }
 
-       std::string name() const { return _name; }
-
        bool ok() const { return _ok; }
 
        static RequestType new_request_type();
@@ -107,7 +105,6 @@ class LIBPBD_API BaseUI : public sigc::trackable, public PBD::EventLoop
        virtual void handle_ui_requests () = 0;
 
   private:
-       std::string _name;
        BaseUI* base_ui_instance;
 
        CrossThreadChannel request_channel;
index a10036549796ffb7567e1538213d6a636e662534..3ea6388f3f6dc34c1a2a589dcc73fd904fa9d0bc 100644 (file)
@@ -20,6 +20,7 @@
 #ifndef __pbd_event_loop_h__
 #define __pbd_event_loop_h__
 
+#include <string>
 #include <boost/function.hpp>
 #include <boost/bind.hpp> /* we don't need this here, but anything calling call_slot() probably will, so this is convenient */
 #include <glibmm/threads.h>
@@ -41,7 +42,7 @@ namespace PBD
 class LIBPBD_API EventLoop
 {
   public:
-       EventLoop() {}
+       EventLoop (std::string const&);
        virtual ~EventLoop() {}
 
        enum RequestType {
@@ -73,12 +74,14 @@ class LIBPBD_API EventLoop
        virtual void call_slot (InvalidationRecord*, const boost::function<void()>&) = 0;
         virtual Glib::Threads::Mutex& slot_invalidation_mutex() = 0;
 
+        std::string event_loop_name() const { return _name; }
+
        static EventLoop* get_event_loop_for_thread();
        static void set_event_loop_for_thread (EventLoop* ui);
 
   private:
         static Glib::Threads::Private<EventLoop> thread_event_loop;
-
+       std::string _name;
 };
 
 }