drop_threads ();
}
+ _threads_active = true;
+
if (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::main_thread, this)) != 0) {
throw failed_constructor ();
}
throw failed_constructor ();
}
}
- _threads_active = true;
}
void
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 ();
prep ();
- if (_graph_empty) {
+ if (_graph_empty && _threads_active) {
goto again;
}
DEBUG_TRACE(DEBUG::ProcessThreads, string_compose ("%1 has finished run_one()\n", pthread_name()));
- return false;
+ return !_threads_active;
}
void
again:
_callback_start_sem.wait ();
-
+
DEBUG_TRACE(DEBUG::ProcessThreads, "main thread is awake\n");
if (!_threads_active) {
}
pt->drop_buffers();
+ delete (pt);
}
void