diff options
author | Robin Gareus <robin@gareus.org> | 2016-04-24 00:24:43 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-04-24 00:24:43 +0200 |
commit | f8936ebcb1b8c95bfa5969ac92cfbde87023778c (patch) | |
tree | 83830fe4728decfaf02940d1a708a1789f414318 /libs/ardour/session.cc | |
parent | 2a7a64a8738413df27e494e67c31695a429f6edc (diff) |
Disconnect Signals before dropping ports
significantly speeds up session close
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r-- | libs/ardour/session.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index b93d685bfc..3b03985ece 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -591,6 +591,9 @@ Session::destroy () _state_of_the_state = StateOfTheState (CannotSave|Deletion); + /* stop autoconnecting */ + auto_connect_thread_terminate (); + /* disconnect from any and all signals that we are connected to */ drop_connections (); @@ -613,6 +616,7 @@ Session::destroy () * callbacks from the engine any more. */ + Port::PortSignalDrop (); /* EMIT SIGNAL */ Port::PortDrop (); /* EMIT SIGNAL */ ltc_tx_cleanup(); @@ -725,8 +729,6 @@ Session::destroy () pthread_cond_destroy (&_rt_emit_cond); pthread_mutex_destroy (&_rt_emit_mutex); - auto_connect_thread_terminate (); - pthread_cond_destroy (&_auto_connect_cond); pthread_mutex_destroy (&_auto_connect_mutex); @@ -6791,12 +6793,12 @@ Session::auto_connect_thread_start () if (_ac_thread_active) { return; } - _ac_thread_active = true; - // clear queue + while (!_auto_connect_queue.empty ()) { _auto_connect_queue.pop (); } + _ac_thread_active = true; if (pthread_create (&_auto_connect_thread, NULL, auto_connect_thread, this)) { _ac_thread_active = false; } @@ -6810,6 +6812,13 @@ Session::auto_connect_thread_terminate () } _ac_thread_active = false; + { + Glib::Threads::Mutex::Lock lx (_auto_connect_queue_lock); + while (!_auto_connect_queue.empty ()) { + _auto_connect_queue.pop (); + } + } + if (pthread_mutex_lock (&_auto_connect_mutex) == 0) { pthread_cond_signal (&_auto_connect_cond); pthread_mutex_unlock (&_auto_connect_mutex); |