summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/server/JackDriver.cpp20
-rw-r--r--src/server/JackDriver.hpp29
2 files changed, 21 insertions, 28 deletions
diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp
index 246d6fdb..2e2f7c0c 100644
--- a/src/server/JackDriver.cpp
+++ b/src/server/JackDriver.cpp
@@ -186,7 +186,6 @@ JackPort::post_process(ProcessContext& context)
JackDriver::JackDriver(Engine& engine)
: _engine(engine)
- , _jack_thread(NULL)
, _sem(0)
, _flag(0)
, _client(NULL)
@@ -206,8 +205,6 @@ JackDriver::~JackDriver()
if (_client)
jack_client_close(_client);
-
- delete _jack_thread;
}
bool
@@ -324,8 +321,7 @@ JackDriver::deactivate()
_client = NULL;
}
- delete _jack_thread;
- _jack_thread = NULL;
+ _jack_threads.clear();
LOG(info) << "Deactivated Jack client" << endl;
}
@@ -487,13 +483,10 @@ JackDriver::_process_cb(jack_nframes_t nframes)
void
JackDriver::_thread_init_cb()
{
- if (_jack_thread) {
- delete _jack_thread;
- }
-
- _jack_thread = &Thread::get();
- _jack_thread->set_name("Jack");
- _jack_thread->set_context(THREAD_PROCESS);
+ Raul::Thread* thread = &Thread::get();
+ thread->set_name("Jack");
+ thread->set_context(THREAD_PROCESS);
+ _jack_threads.push_back(SharedPtr<Raul::Thread>(thread));
}
void
@@ -501,8 +494,7 @@ JackDriver::_shutdown_cb()
{
LOG(info) << "Jack shutdown. Exiting." << endl;
_is_activated = false;
- delete _jack_thread;
- _jack_thread = NULL;
+ _jack_threads.clear();
_client = NULL;
}
diff --git a/src/server/JackDriver.hpp b/src/server/JackDriver.hpp
index 5439c95c..d39319ba 100644
--- a/src/server/JackDriver.hpp
+++ b/src/server/JackDriver.hpp
@@ -20,6 +20,7 @@
#include "ingen-config.h"
+#include <list>
#include <string>
#include <jack/jack.h>
@@ -161,20 +162,20 @@ private:
void _session_cb(jack_session_event_t* event);
#endif
- Engine& _engine;
- Raul::Thread* _jack_thread;
- Raul::Semaphore _sem;
- Raul::AtomicInt _flag;
- jack_client_t* _client;
- jack_nframes_t _block_length;
- jack_nframes_t _sample_rate;
- uint32_t _midi_event_type;
- bool _is_activated;
- jack_position_t _position;
- jack_transport_state_t _transport_state;
- Raul::List<JackPort*> _ports;
- ProcessContext _process_context;
- PatchImpl* _root_patch;
+ Engine& _engine;
+ std::list< SharedPtr<Raul::Thread> > _jack_threads;
+ Raul::Semaphore _sem;
+ Raul::AtomicInt _flag;
+ jack_client_t* _client;
+ jack_nframes_t _block_length;
+ jack_nframes_t _sample_rate;
+ uint32_t _midi_event_type;
+ bool _is_activated;
+ jack_position_t _position;
+ jack_transport_state_t _transport_state;
+ Raul::List<JackPort*> _ports;
+ ProcessContext _process_context;
+ PatchImpl* _root_patch;
};
} // namespace Server