X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fgraph.cc;h=3e878533193afcada7f3d5d9f0bcb3958c890c2d;hb=f6d29abfc75c460b9e35717f2907e4e61bf38058;hp=12752c158e91e0b54cbc0ba1c4ae9a9d87365c1d;hpb=0aac62e013e15e380001dafae39d554f8765a4a1;p=ardour.git diff --git a/libs/ardour/graph.cc b/libs/ardour/graph.cc index 12752c158e..3e87853319 100644 --- a/libs/ardour/graph.cc +++ b/libs/ardour/graph.cc @@ -32,8 +32,6 @@ #include "ardour/process_thread.h" #include "ardour/audioengine.h" -#include - #include "i18n.h" using namespace ARDOUR; @@ -97,29 +95,24 @@ Graph::reset_thread_list () number of threads. */ - if (_thread_list.size() == num_threads) { + if (AudioEngine::instance()->process_thread_count() == num_threads) { return; } Glib::Threads::Mutex::Lock lm (_session.engine().process_lock()); - jack_native_thread_t a_thread; - if (!_thread_list.empty()) { + if (AudioEngine::instance()->process_thread_count() != 0) { drop_threads (); } - if (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::main_thread, this), &a_thread, 100000) != 0) { + if (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::main_thread, this)) != 0) { throw failed_constructor (); } - _thread_list.push_back (a_thread); - for (uint32_t i = 1; i < num_threads; ++i) { - if (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::helper_thread, this), &a_thread, 100000) != 0) { + if (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::helper_thread, this))) { throw failed_constructor (); } - - _thread_list.push_back (a_thread); } } @@ -141,17 +134,15 @@ Graph::drop_threads () { _quit_threads = true; - for (unsigned int i=0; i< _thread_list.size(); i++) { + uint32_t thread_count = AudioEngine::instance()->process_thread_count (); + + for (unsigned int i=0; i < thread_count; i++) { _execution_sem.signal (); } _callback_start_sem.signal (); - for (list::iterator i = _thread_list.begin(); i != _thread_list.end(); ++i) { - AudioEngine::instance()->stop_process_thread(*i); - } - - _thread_list.clear (); + AudioEngine::instance()->join_process_threads (); _execution_tokens = 0; @@ -231,7 +222,7 @@ Graph::trigger (GraphNode* n) void Graph::dec_ref() { - if (g_atomic_int_dec_and_test (&_finished_refcount)) { + if (g_atomic_int_dec_and_test (const_cast (&_finished_refcount))) { /* We have run all the nodes that are at the `output' end of the graph, so there is nothing more to do this time around. @@ -584,12 +575,5 @@ Graph::process_one_route (Route* route) bool Graph::in_process_thread () const { -#ifndef WIN32 - for (list::const_iterator i = _thread_list.begin (); i != _thread_list.end(); ++i) { - if (*i == pthread_self()) { - return true; - } - } - return false; -#endif + return AudioEngine::instance()->in_process_thread (); }