summaryrefslogtreecommitdiff
path: root/libs/ardour/graph.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-08-28 15:39:06 +0200
committerRobin Gareus <robin@gareus.org>2015-08-28 15:39:06 +0200
commit3a3d5c41bec55ebf620957bf4a4ee9a501c6d4f6 (patch)
tree092f1125caeb5d88e9848bbba9d1e424b2cbf9b4 /libs/ardour/graph.cc
parent9458fce148c862f5504d88754d5418972dd4046b (diff)
synchronous shutdown of process graph.
Diffstat (limited to 'libs/ardour/graph.cc')
-rw-r--r--libs/ardour/graph.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/libs/ardour/graph.cc b/libs/ardour/graph.cc
index de2ec802df..b321968daf 100644
--- a/libs/ardour/graph.cc
+++ b/libs/ardour/graph.cc
@@ -117,6 +117,8 @@ Graph::reset_thread_list ()
drop_threads ();
}
+ _threads_active = true;
+
if (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::main_thread, this)) != 0) {
throw failed_constructor ();
}
@@ -126,7 +128,6 @@ Graph::reset_thread_list ()
throw failed_constructor ();
}
}
- _threads_active = true;
}
void
@@ -145,15 +146,20 @@ Graph::session_going_away()
void
Graph::drop_threads ()
{
+ Glib::Threads::Mutex::Lock ls (_swap_mutex);
_threads_active = false;
uint32_t thread_count = AudioEngine::instance()->process_thread_count ();
for (unsigned int i=0; i < thread_count; i++) {
+ pthread_mutex_lock (&_trigger_mutex);
_execution_sem.signal ();
+ pthread_mutex_unlock (&_trigger_mutex);
}
+ pthread_mutex_lock (&_trigger_mutex);
_callback_start_sem.signal ();
+ pthread_mutex_unlock (&_trigger_mutex);
AudioEngine::instance()->join_process_threads ();
@@ -260,7 +266,7 @@ Graph::restart_cycle()
prep ();
- if (_graph_empty) {
+ if (_graph_empty && _threads_active) {
goto again;
}
@@ -396,7 +402,7 @@ Graph::run_one()
DEBUG_TRACE(DEBUG::ProcessThreads, string_compose ("%1 has finished run_one()\n", pthread_name()));
- return false;
+ return !_threads_active;
}
void