mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-09 15:15:41 +01:00
merge with master
This commit is contained in:
commit
4a6412aebe
10 changed files with 53 additions and 14 deletions
|
|
@ -399,7 +399,13 @@ class AudioBackend {
|
|||
* stacksize. The thread will begin executing @param func, and will exit
|
||||
* when that function returns.
|
||||
*/
|
||||
virtual int create_process_thread (boost::function<void()> func, pthread_t*, size_t stacksize) = 0;
|
||||
virtual int create_process_thread (boost::function<void()> func, AudioBackendNativeThread*, size_t stacksize) = 0;
|
||||
|
||||
/** Wait for the thread specified by @param thread to exit.
|
||||
*
|
||||
* Return zero on success, non-zero on failure.
|
||||
*/
|
||||
virtual int wait_for_process_thread_exit (AudioBackendNativeThread thread) = 0;
|
||||
|
||||
virtual void update_latencies () = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,8 @@ public:
|
|||
pframes_t sample_time_at_cycle_start ();
|
||||
pframes_t samples_since_cycle_start ();
|
||||
bool get_sync_offset (pframes_t& offset) const;
|
||||
int create_process_thread (boost::function<void()> func, pthread_t*, size_t stacksize);
|
||||
int create_process_thread (boost::function<void()> func, AudioBackendNativeThread*, size_t stacksize);
|
||||
int wait_for_process_thread_exit (AudioBackendNativeThread);
|
||||
bool is_realtime() const;
|
||||
bool connected() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include "pbd/semutils.h"
|
||||
|
||||
#include "ardour/types.h"
|
||||
#include "ardour/audio_backend.h"
|
||||
#include "ardour/session_handle.h"
|
||||
|
||||
namespace ARDOUR
|
||||
|
|
@ -92,7 +93,7 @@ protected:
|
|||
virtual void session_going_away ();
|
||||
|
||||
private:
|
||||
std::list<pthread_t> _thread_list;
|
||||
std::list<AudioBackendNativeThread> _thread_list;
|
||||
volatile bool _quit_threads;
|
||||
|
||||
void reset_thread_list ();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include <boost/shared_ptr.hpp>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
|
|
@ -609,6 +610,16 @@ namespace ARDOUR {
|
|||
uint32_t max; //< samples
|
||||
};
|
||||
|
||||
/* PLATFORM SPECIFIC #ifdef's here */
|
||||
|
||||
/** Define the native thread type used on the platform */
|
||||
typedef pthread_t AudioBackendNativeThread;
|
||||
static inline bool self_thread_equal (AudioBackendNativeThread thr) {
|
||||
return pthread_equal (thr, pthread_self());
|
||||
}
|
||||
|
||||
/* PLATFORM SPECIFIC #endif's here */
|
||||
|
||||
} // namespace ARDOUR
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -814,7 +814,7 @@ AudioEngine::get_sync_offset (pframes_t& offset) const
|
|||
}
|
||||
|
||||
int
|
||||
AudioEngine::create_process_thread (boost::function<void()> func, pthread_t* thr, size_t stacksize)
|
||||
AudioEngine::create_process_thread (boost::function<void()> func, AudioBackendNativeThread* thr, size_t stacksize)
|
||||
{
|
||||
if (!_backend) {
|
||||
return -1;
|
||||
|
|
@ -822,6 +822,14 @@ AudioEngine::create_process_thread (boost::function<void()> func, pthread_t* thr
|
|||
return _backend->create_process_thread (func, thr, stacksize);
|
||||
}
|
||||
|
||||
int
|
||||
AudioEngine::wait_for_process_thread_exit (AudioBackendNativeThread thr)
|
||||
{
|
||||
if (!_backend) {
|
||||
return 0;
|
||||
}
|
||||
return _backend->wait_for_process_thread_exit (thr);
|
||||
}
|
||||
|
||||
int
|
||||
AudioEngine::set_device_name (const std::string& name)
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ Graph::reset_thread_list ()
|
|||
}
|
||||
|
||||
Glib::Threads::Mutex::Lock lm (_session.engine().process_lock());
|
||||
jack_native_thread_t a_thread;
|
||||
AudioBackendNativeThread a_thread;
|
||||
|
||||
if (!_thread_list.empty()) {
|
||||
drop_threads ();
|
||||
|
|
@ -147,8 +147,8 @@ Graph::drop_threads ()
|
|||
|
||||
_callback_start_sem.signal ();
|
||||
|
||||
for (list<jack_native_thread_t>::iterator i = _thread_list.begin(); i != _thread_list.end(); ++i) {
|
||||
AudioEngine::instance()->stop_process_thread(*i);
|
||||
for (list<AudioBackendNativeThread>::iterator i = _thread_list.begin(); i != _thread_list.end(); ++i) {
|
||||
AudioEngine::instance()->wait_for_process_thread_exit (*i);
|
||||
}
|
||||
|
||||
_thread_list.clear ();
|
||||
|
|
@ -584,12 +584,10 @@ Graph::process_one_route (Route* route)
|
|||
bool
|
||||
Graph::in_process_thread () const
|
||||
{
|
||||
#ifndef COMPILER_MINGW
|
||||
for (list<pthread_t>::const_iterator i = _thread_list.begin (); i != _thread_list.end(); ++i) {
|
||||
if (pthread_equal(*i, pthread_self())) {
|
||||
for (list<AudioBackendNativeThread>::const_iterator i = _thread_list.begin (); i != _thread_list.end(); ++i) {
|
||||
if (self_thread_equal (*i)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -789,6 +789,14 @@ JACKAudioBackend::create_process_thread (boost::function<void()> f, pthread_t* t
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
JACKAudioBackend::wait_for_process_thread_exit (AudioBackendNativeThread thr)
|
||||
{
|
||||
void* status;
|
||||
/* this doesn't actively try to stop the thread, it just waits till it exits */
|
||||
return pthread_join (thr, &status);
|
||||
}
|
||||
|
||||
void*
|
||||
JACKAudioBackend::_start_process_thread (void* arg)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -100,7 +100,8 @@ class JACKAudioBackend : public AudioBackend {
|
|||
|
||||
size_t raw_buffer_size (DataType t);
|
||||
|
||||
int create_process_thread (boost::function<void()> func, pthread_t*, size_t stacksize);
|
||||
int create_process_thread (boost::function<void()> func, AudioBackendNativeThread*, size_t stacksize);
|
||||
int wait_for_process_thread_exit (AudioBackendNativeThread);
|
||||
|
||||
void transport_start ();
|
||||
void transport_stop ();
|
||||
|
|
|
|||
|
|
@ -682,7 +682,7 @@ ARDOUR::JackCommandLineOptions::JackCommandLineOptions ()
|
|||
}
|
||||
|
||||
bool
|
||||
ARDOUR::get_jack_command_line_string (const JackCommandLineOptions& options, string& command_line)
|
||||
ARDOUR::get_jack_command_line_string (JackCommandLineOptions& options, string& command_line)
|
||||
{
|
||||
vector<string> args;
|
||||
|
||||
|
|
@ -699,6 +699,11 @@ ARDOUR::get_jack_command_line_string (const JackCommandLineOptions& options, str
|
|||
}
|
||||
#endif
|
||||
|
||||
/* XXX hack to enforce qjackctl-like behaviour */
|
||||
if (options.timeout == 0) {
|
||||
options.timeout = 200;
|
||||
}
|
||||
|
||||
if (options.timeout) {
|
||||
args.push_back ("-t");
|
||||
args.push_back (to_string (options.timeout, std::dec));
|
||||
|
|
|
|||
|
|
@ -231,5 +231,5 @@ namespace ARDOUR {
|
|||
/**
|
||||
* @return true if able to build a valid command line based on options
|
||||
*/
|
||||
bool get_jack_command_line_string (const JackCommandLineOptions& options, std::string& command_line);
|
||||
bool get_jack_command_line_string (JackCommandLineOptions& options, std::string& command_line);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue