diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-05-14 17:07:53 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-05-14 17:07:53 +0000 |
commit | 37969d837e16c8fbac0821074495b5ebc2297d94 (patch) | |
tree | b79e840e364c8502aabbf785c28364c596a4632f /libs/pbd/base_ui.cc | |
parent | 69a242ba6496aa8d4e565a82675ca549a11e4080 (diff) |
remove virtual inheritance of sigc::trackable by Receiver and AbstractUI<T>, done by changing Gtkmm2ext::UI to use composition (HAS-A) rather than inheritance (IS-A) for Receiver; use correct synchronization when starting up a BseUI event loop thread so that tests that start/stop quickly do not encounter a race condition
git-svn-id: svn://localhost/ardour2/branches/3.0@12264 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/base_ui.cc')
-rw-r--r-- | libs/pbd/base_ui.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libs/pbd/base_ui.cc b/libs/pbd/base_ui.cc index 31f956f4cf..c246a50656 100644 --- a/libs/pbd/base_ui.cc +++ b/libs/pbd/base_ui.cc @@ -74,11 +74,22 @@ void BaseUI::main_thread () { DEBUG_TRACE (DEBUG::EventLoop, string_compose ("%1: event loop running in thread %2\n", name(), pthread_self())); + std::cerr << string_compose ("%1: event loop running in thread %2\n", name(), pthread_self()); set_event_loop_for_thread (this); thread_init (); + _main_loop->get_context()->signal_idle().connect (sigc::mem_fun (*this, &BaseUI::signal_running)); _main_loop->run (); } +bool +BaseUI::signal_running () +{ + Glib::Mutex::Lock lm (_run_lock); + _running.signal (); + + return false; // don't call it again +} + void BaseUI::run () { @@ -91,7 +102,11 @@ BaseUI::run () /* glibmm hack - drop the refptr to the IOSource now before it can hurt */ request_channel.drop_ios (); + Glib::Mutex::Lock lm (_run_lock); run_loop_thread = Thread::create (mem_fun (*this, &BaseUI::main_thread), true); + std::cerr << "wait for " << name() << " thread to start\n"; + _running.wait (_run_lock); + std::cerr << "\tthread now running\n"; } void |