mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-12 01:26:31 +01:00
Reset process-graph semaphores on engine-restart
This commit is contained in:
parent
9c0ba3b3d5
commit
1e8462f45e
1 changed files with 22 additions and 0 deletions
|
|
@ -88,6 +88,9 @@ Graph::Graph (Session & session)
|
||||||
void
|
void
|
||||||
Graph::engine_stopped ()
|
Graph::engine_stopped ()
|
||||||
{
|
{
|
||||||
|
#ifndef NDEBUG
|
||||||
|
cerr << "Graph::engine_stopped. n_thread: " << AudioEngine::instance()->process_thread_count() << endl;
|
||||||
|
#endif
|
||||||
if (AudioEngine::instance()->process_thread_count() != 0) {
|
if (AudioEngine::instance()->process_thread_count() != 0) {
|
||||||
drop_threads ();
|
drop_threads ();
|
||||||
}
|
}
|
||||||
|
|
@ -162,7 +165,24 @@ Graph::drop_threads ()
|
||||||
|
|
||||||
AudioEngine::instance()->join_process_threads ();
|
AudioEngine::instance()->join_process_threads ();
|
||||||
|
|
||||||
|
/* signal main process thread if it's waiting for an already terminated thread */
|
||||||
|
_callback_done_sem.signal ();
|
||||||
_execution_tokens = 0;
|
_execution_tokens = 0;
|
||||||
|
|
||||||
|
/* reset semaphores.
|
||||||
|
* This is somewhat ugly, yet if a thread is killed (e.g jackd terminates
|
||||||
|
* abnormally), some semaphores are still unlocked.
|
||||||
|
*/
|
||||||
|
#ifndef NDEBUG
|
||||||
|
int d1 = _execution_sem.reset ();
|
||||||
|
int d2 = _callback_start_sem.reset ();
|
||||||
|
int d3 = _callback_done_sem.reset ();
|
||||||
|
cerr << "Graph::drop_threads() sema-counts: " << d1 << ", " << d2<< ", " << d3 << endl;
|
||||||
|
#else
|
||||||
|
_execution_sem.reset ();
|
||||||
|
_callback_start_sem.reset ();
|
||||||
|
_callback_done_sem.reset ();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -438,6 +458,8 @@ again:
|
||||||
DEBUG_TRACE(DEBUG::ProcessThreads, "main thread is awake\n");
|
DEBUG_TRACE(DEBUG::ProcessThreads, "main thread is awake\n");
|
||||||
|
|
||||||
if (!_threads_active) {
|
if (!_threads_active) {
|
||||||
|
pt->drop_buffers();
|
||||||
|
delete (pt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue