Requires future attention in AudioEngine due to timbyr's use JACK2 extension to JACK API
static void destroy();
void died ();
static void destroy();
void died ();
- int create_process_thread (boost::function<void()>, pthread_t*, size_t stacksize);
+ int create_process_thread (boost::function<void()>, jack_native_thread_t*, size_t stacksize);
+ bool stop_process_thread (jack_native_thread_t);
private:
static AudioEngine* _instance;
private:
static AudioEngine* _instance;
virtual void session_going_away ();
private:
virtual void session_going_away ();
private:
- std::list<pthread_t> _thread_list;
+ std::list<jack_native_thread_t> _thread_list;
volatile bool _quit_threads;
void reset_thread_list ();
volatile bool _quit_threads;
void reset_thread_list ();
-AudioEngine::create_process_thread (boost::function<void()> f, pthread_t* thread, size_t stacksize)
+AudioEngine::create_process_thread (boost::function<void()> f, jack_native_thread_t* thread, size_t stacksize)
{
GET_PRIVATE_JACK_POINTER_RET (_jack, 0);
ThreadData* td = new ThreadData (this, f, stacksize);
{
GET_PRIVATE_JACK_POINTER_RET (_jack, 0);
ThreadData* td = new ThreadData (this, f, stacksize);
+bool
+AudioEngine::stop_process_thread (jack_native_thread_t thread)
+{
+ /**
+ * can't use GET_PRIVATE_JACK_POINTER_RET (_jack, 0) here
+ * because _jack is 0 when this is called. At least for
+ * Jack 2 _jack arg is not used so it should be OK
+ */
+
+#ifdef USING_JACK2_EXPANSION_OF_JACK_API
+ if (jack_client_stop_thread (_jack, thread) != 0) {
+ error << "AudioEngine: cannot stop process thread" << endmsg;
+ return false;
+ }
+#else
+ void* status;
+ pthread_join (thread, &status);
+#endif
+
+ return true;
+}
+
void*
AudioEngine::_start_process_thread (void* arg)
{
void*
AudioEngine::_start_process_thread (void* arg)
{
}
Glib::Threads::Mutex::Lock lm (_session.engine().process_lock());
}
Glib::Threads::Mutex::Lock lm (_session.engine().process_lock());
+ jack_native_thread_t a_thread;
if (!_thread_list.empty()) {
drop_threads ();
if (!_thread_list.empty()) {
drop_threads ();
_callback_start_sem.signal ();
_callback_start_sem.signal ();
- for (list<pthread_t>::iterator i = _thread_list.begin(); i != _thread_list.end(); ++i) {
- void* status;
- pthread_join (*i, &status);
+ for (list<jack_native_thread_t>::iterator i = _thread_list.begin(); i != _thread_list.end(); ++i) {
+ AudioEngine::instance()->stop_process_thread(*i);