mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-29 09:57:44 +01:00
fix all 4 backends' failure to include the main "backend" thread when computing ::in_process_thread()
This commit is contained in:
parent
aa0effb4cb
commit
68458cde69
6 changed files with 37 additions and 7 deletions
|
|
@ -758,6 +758,10 @@ AlsaAudioBackend::join_process_threads ()
|
|||
bool
|
||||
AlsaAudioBackend::in_process_thread ()
|
||||
{
|
||||
if (pthread_equal (_main_thread, pthread_self()) != 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (std::vector<pthread_t>::const_iterator i = _threads.begin (); i != _threads.end (); ++i)
|
||||
{
|
||||
if (pthread_equal (*i, pthread_self ()) != 0) {
|
||||
|
|
|
|||
|
|
@ -516,6 +516,10 @@ DummyAudioBackend::join_process_threads ()
|
|||
bool
|
||||
DummyAudioBackend::in_process_thread ()
|
||||
{
|
||||
if (pthread_equal (_main_thread, pthread_self()) != 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (std::vector<pthread_t>::const_iterator i = _threads.begin (); i != _threads.end (); ++i)
|
||||
{
|
||||
if (pthread_equal (*i, pthread_self ()) != 0) {
|
||||
|
|
|
|||
|
|
@ -862,6 +862,16 @@ JACKAudioBackend::join_process_threads ()
|
|||
bool
|
||||
JACKAudioBackend::in_process_thread ()
|
||||
{
|
||||
#ifdef COMPILER_MINGW
|
||||
if (_main_thread == GetCurrentThread()) {
|
||||
return true;
|
||||
}
|
||||
#else // pthreads
|
||||
if (pthread_equal (_main_thread, pthread_self()) != 0) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (std::vector<jack_native_thread_t>::const_iterator i = _jack_threads.begin ();
|
||||
i != _jack_threads.end(); i++) {
|
||||
|
||||
|
|
@ -909,6 +919,8 @@ JACKAudioBackend::process_thread ()
|
|||
/* JACK doesn't do this for us when we use the wait API
|
||||
*/
|
||||
|
||||
_main_thread = pthread_self ();
|
||||
|
||||
AudioEngine::thread_init_callback (this);
|
||||
|
||||
while (1) {
|
||||
|
|
|
|||
|
|
@ -209,6 +209,7 @@ class JACKAudioBackend : public AudioBackend {
|
|||
std::map<DataType,size_t> _raw_buffer_sizes;
|
||||
|
||||
std::vector<jack_native_thread_t> _jack_threads;
|
||||
jack_native_thread_t _main_thread;
|
||||
|
||||
static int _xrun_callback (void *arg);
|
||||
static void* _process_thread (void *arg);
|
||||
|
|
|
|||
|
|
@ -721,6 +721,11 @@ WavesAudioBackend::_audio_device_callback (const float* input_buffer,
|
|||
// COMMENTED FREQUENT DBG LOGS */ std::cout << "WavesAudioBackend::_audio_device_callback ():" << _device->DeviceName () << std::endl;
|
||||
_sample_time_at_cycle_start = sample_time;
|
||||
_cycle_start_time_nanos = cycle_start_time_nanos;
|
||||
|
||||
/* There is the possibility that the thread this runs in may change from
|
||||
* callback to callback, so do it every time.
|
||||
*/
|
||||
_main_thread = pthread_self ();
|
||||
|
||||
if (_buffer_size != nframes) {
|
||||
// COMMENTED DBG LOGS */ std::cout << "\tAudioEngine::thread_init_callback() buffer size and nframes are not equal: " << _buffer_size << "!=" << nframes << std::endl;
|
||||
|
|
@ -1099,13 +1104,16 @@ bool
|
|||
WavesAudioBackend::in_process_thread ()
|
||||
{
|
||||
// COMMENTED DBG LOGS */ std::cout << "WavesAudioBackend::in_process_thread ()" << std::endl;
|
||||
for (std::vector<pthread_t>::const_iterator i = _backend_threads.begin ();
|
||||
i != _backend_threads.end (); i++) {
|
||||
if (pthread_equal (*i, pthread_self ()) != 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
if (pthread_equal (_main_thread, pthread_self()) != 0) {
|
||||
return true;
|
||||
}
|
||||
for (std::vector<pthread_t>::const_iterator i = _backend_threads.begin ();
|
||||
i != _backend_threads.end (); i++) {
|
||||
if (pthread_equal (*i, pthread_self ()) != 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -316,6 +316,7 @@ class WavesMidiPort;
|
|||
uint32_t _systemic_output_latency;
|
||||
bool _call_thread_init_callback;
|
||||
std::vector<pthread_t> _backend_threads;
|
||||
pthread_t _main_thread;
|
||||
static const size_t __max_raw_midi_buffer_size;
|
||||
|
||||
static const std::vector<std::string> __available_midi_options;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue