13
0

fix dubious conflation of int and pthread_t

git-svn-id: svn://localhost/ardour2/branches/3.0@7998 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2010-11-10 22:50:52 +00:00
parent 2a00515a78
commit ab399143a6
3 changed files with 16 additions and 9 deletions

View File

@ -240,7 +240,7 @@ _ the regular process() call to session->process() is not made.
static AudioEngine* instance() { return _instance; }
void died ();
pthread_t create_process_thread (boost::function<void()>, size_t stacksize);
int create_process_thread (boost::function<void()>, pthread_t*, size_t stacksize);
private:
static AudioEngine* _instance;

View File

@ -1477,19 +1477,18 @@ AudioEngine::is_realtime () const
return jack_is_realtime (_priv_jack);
}
pthread_t
AudioEngine::create_process_thread (boost::function<void()> f, size_t stacksize)
int
AudioEngine::create_process_thread (boost::function<void()> f, pthread_t* thread, size_t stacksize)
{
GET_PRIVATE_JACK_POINTER_RET (_jack, 0);
pthread_t thread;
ThreadData* td = new ThreadData (this, f, stacksize);
if (jack_client_create_thread (_priv_jack, &thread, jack_client_real_time_priority (_priv_jack),
if (jack_client_create_thread (_priv_jack, thread, jack_client_real_time_priority (_priv_jack),
jack_is_realtime (_priv_jack), _start_process_thread, td)) {
return -1;
}
return thread;
return 0;
}
void*

View File

@ -82,10 +82,15 @@ Graph::Graph (Session & session)
info << string_compose (_("Using %2 threads on %1 CPUs"), num_cpu, num_threads) << endmsg;
_thread_list.push_back (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::main_thread, this), 100000));
pthread_t a_thread;
if (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::main_thread, this), &a_thread, 100000) == 0) {
_thread_list.push_back (a_thread);
}
for (int i = 1; i < num_threads; ++i) {
_thread_list.push_back (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::helper_thread, this), 100000));
if (AudioEngine::instance()->create_process_thread (boost::bind (&Graph::helper_thread, this), &a_thread, 100000));
_thread_list.push_back (a_thread);
}
}
@ -317,7 +322,10 @@ Graph::run_one()
to_run = 0;
}
int wakeup = min ((int) _execution_tokens, (int) _trigger_queue.size());
int et = _execution_tokens;
int ts = _trigger_queue.size();
int wakeup = min (et, ts);
_execution_tokens -= wakeup;
for (int i=0; i<wakeup; i++ ) {