fix all 4 backends' failure to include the main "backend" thread when computing ::in_process_thread()

This commit is contained in:
Paul Davis 2014-10-22 17:02:15 -04:00
parent aa0effb4cb
commit 68458cde69
6 changed files with 37 additions and 7 deletions

View file

@ -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;
}

View file

@ -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;