diff --git a/libs/ardour/io_tasklist.cc b/libs/ardour/io_tasklist.cc index d5dd73894f..69582be615 100644 --- a/libs/ardour/io_tasklist.cc +++ b/libs/ardour/io_tasklist.cc @@ -76,7 +76,7 @@ IOTaskList::IOTaskList (uint32_t n_threads) _workers.resize (_n_threads); for (uint32_t i = 0; i < _n_threads; ++i) { - if (!use_rt || pbd_realtime_pthread_create (policy, PBD_RT_PRI_IOFX, 0, &_workers[i], &_worker_thread, this)) { + if (!use_rt || pbd_realtime_pthread_create ("I/O", policy, PBD_RT_PRI_IOFX, 0, &_workers[i], &_worker_thread, this)) { if (use_rt && i == 0) { PBD::warning << _("IOTaskList: cannot acquire realtime permissions.") << endmsg; } diff --git a/libs/backends/alsa/alsa_audiobackend.cc b/libs/backends/alsa/alsa_audiobackend.cc index 67794bef9d..d81fbab9ee 100644 --- a/libs/backends/alsa/alsa_audiobackend.cc +++ b/libs/backends/alsa/alsa_audiobackend.cc @@ -952,7 +952,7 @@ AlsaAudioBackend::_start (bool for_latency_measurement) _run = true; _port_change_flag.store (0); - if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_PROC, + if (pbd_realtime_pthread_create ("ALSA Main", PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_PROC, &_main_thread, pthread_process, this)) { if (pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &_main_thread, pthread_process, this)) { PBD::error << _("AlsaAudioBackend: failed to create process thread.") << endmsg; @@ -1152,7 +1152,7 @@ AlsaAudioBackend::create_process_thread (boost::function func) pthread_t thread_id; ThreadData* td = new ThreadData (this, func, PBD_RT_STACKSIZE_PROC); - if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC, &thread_id, alsa_process_thread, td)) { + if (pbd_realtime_pthread_create ("ALSA Proc", PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC, &thread_id, alsa_process_thread, td)) { if (pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &thread_id, alsa_process_thread, td)) { PBD::error << _("AudioEngine: cannot create process thread.") << endmsg; return -1; diff --git a/libs/backends/alsa/alsa_midi.cc b/libs/backends/alsa/alsa_midi.cc index 272f391682..15d25cc64b 100644 --- a/libs/backends/alsa/alsa_midi.cc +++ b/libs/backends/alsa/alsa_midi.cc @@ -73,7 +73,7 @@ static void * pthread_process (void *arg) int AlsaMidiIO::start () { - if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_MIDI, PBD_RT_STACKSIZE_HELP, + if (pbd_realtime_pthread_create ("ALSA MIDI", PBD_SCHED_FIFO, PBD_RT_PRI_MIDI, PBD_RT_STACKSIZE_HELP, &_main_thread, pthread_process, this)) { if (pbd_pthread_create (PBD_RT_STACKSIZE_HELP, &_main_thread, pthread_process, this)) { diff --git a/libs/backends/alsa/alsa_slave.cc b/libs/backends/alsa/alsa_slave.cc index bc8a1bfd15..6f1025e1d9 100644 --- a/libs/backends/alsa/alsa_slave.cc +++ b/libs/backends/alsa/alsa_slave.cc @@ -111,7 +111,7 @@ AlsaAudioSlave::start () } _run = true; - if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_HELP, + if (pbd_realtime_pthread_create ("ALSA Slave", PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_HELP, &_thread, _process_thread, this)) { if (pbd_pthread_create (PBD_RT_STACKSIZE_HELP, &_thread, _process_thread, this)) { diff --git a/libs/backends/coreaudio/coreaudio_backend.cc b/libs/backends/coreaudio/coreaudio_backend.cc index a81b7d82d6..f9c245c6be 100644 --- a/libs/backends/coreaudio/coreaudio_backend.cc +++ b/libs/backends/coreaudio/coreaudio_backend.cc @@ -829,7 +829,7 @@ CoreAudioBackend::create_process_thread (boost::function func) } #endif - if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC, + if (pbd_realtime_pthread_create ("CoreAudio Proc", PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC, &thread_id, coreaudio_process_thread, td)) { if (pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &thread_id, coreaudio_process_thread, td)) { PBD::error << _("AudioEngine: cannot create process thread.") << endmsg; diff --git a/libs/backends/dummy/dummy_audiobackend.cc b/libs/backends/dummy/dummy_audiobackend.cc index c20403613e..ae1e8edbe5 100644 --- a/libs/backends/dummy/dummy_audiobackend.cc +++ b/libs/backends/dummy/dummy_audiobackend.cc @@ -431,7 +431,7 @@ DummyAudioBackend::_start (bool /*for_latency_measurement*/) _port_change_flag.store (0); bool ok = _realtime; - if (_realtime && pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_PROC, &_main_thread, pthread_process, this)) { + if (_realtime && pbd_realtime_pthread_create ("Dummy Main", PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_PROC, &_main_thread, pthread_process, this)) { PBD::warning << _("DummyAudioBackend: failed to acquire realtime permissions.") << endmsg; ok = false; } @@ -529,7 +529,7 @@ DummyAudioBackend::create_process_thread (boost::function func) pthread_t thread_id; ThreadData* td = new ThreadData (this, func, PBD_RT_STACKSIZE_PROC); - bool ok = _realtime && 0 == pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC, &thread_id, dummy_process_thread, td); + bool ok = _realtime && 0 == pbd_realtime_pthread_create ("Dummy Proc", PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC, &thread_id, dummy_process_thread, td); if (!ok && pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &thread_id, dummy_process_thread, td)) { PBD::error << _("AudioEngine: cannot create process thread.") << endmsg; return -1; diff --git a/libs/backends/portaudio/portaudio_backend.cc b/libs/backends/portaudio/portaudio_backend.cc index c8268a5045..66c6d56f45 100644 --- a/libs/backends/portaudio/portaudio_backend.cc +++ b/libs/backends/portaudio/portaudio_backend.cc @@ -775,7 +775,7 @@ PortAudioBackend::process_callback(const float* input, bool PortAudioBackend::start_blocking_process_thread () { - if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_PROC, + if (pbd_realtime_pthread_create ("PortAudio Main", PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_PROC, &_main_blocking_thread, blocking_thread_func, this)) { if (pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &_main_blocking_thread, blocking_thread_func, this)) @@ -1103,7 +1103,7 @@ PortAudioBackend::create_process_thread (boost::function func) pthread_t thread_id; ThreadData* td = new ThreadData (this, func, PBD_RT_STACKSIZE_PROC); - if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC, + if (pbd_realtime_pthread_create ("PortAudio Proc", PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC, &thread_id, portaudio_process_thread, td)) { if (pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &thread_id, portaudio_process_thread, td)) { DEBUG_AUDIO("Cannot create process thread."); diff --git a/libs/backends/portaudio/winmmemidi_output_device.cc b/libs/backends/portaudio/winmmemidi_output_device.cc index 316afce614..bd70d7c9d7 100644 --- a/libs/backends/portaudio/winmmemidi_output_device.cc +++ b/libs/backends/portaudio/winmmemidi_output_device.cc @@ -230,7 +230,7 @@ WinMMEMidiOutputDevice::start_midi_output_thread () m_thread_quit = false; // TODO Use native threads - if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_MIDI, PBD_RT_STACKSIZE_HELP, + if (pbd_realtime_pthread_create ("WinMME Output", PBD_SCHED_FIFO, PBD_RT_PRI_MIDI, PBD_RT_STACKSIZE_HELP, &m_output_thread_handle, midi_output_thread, this)) { return false; } diff --git a/libs/backends/pulseaudio/pulseaudio_backend.cc b/libs/backends/pulseaudio/pulseaudio_backend.cc index da4a2d0027..9d4ea88014 100644 --- a/libs/backends/pulseaudio/pulseaudio_backend.cc +++ b/libs/backends/pulseaudio/pulseaudio_backend.cc @@ -584,7 +584,7 @@ PulseAudioBackend::_start (bool /*for_latency_measurement*/) _run = true; _port_change_flag.store (0); - if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_PROC, + if (pbd_realtime_pthread_create ("PulseAudio Main", PBD_SCHED_FIFO, PBD_RT_PRI_MAIN, PBD_RT_STACKSIZE_PROC, &_main_thread, pthread_process, this)) { if (pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &_main_thread, pthread_process, this)) { PBD::error << _("PulseAudioBackend: failed to create process thread.") << endmsg; @@ -703,7 +703,7 @@ PulseAudioBackend::create_process_thread (boost::function func) pthread_t thread_id; ThreadData* td = new ThreadData (this, func, PBD_RT_STACKSIZE_PROC); - if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC, + if (pbd_realtime_pthread_create ("PulseAudio Proc", PBD_SCHED_FIFO, PBD_RT_PRI_PROC, PBD_RT_STACKSIZE_PROC, &thread_id, pulse_process_thread, td)) { if (pbd_pthread_create (PBD_RT_STACKSIZE_PROC, &thread_id, pulse_process_thread, td)) { PBD::error << _("AudioEngine: cannot create process thread.") << endmsg; diff --git a/libs/pbd/pbd/pthread_utils.h b/libs/pbd/pbd/pthread_utils.h index 069f9c9c23..181dcf9ca8 100644 --- a/libs/pbd/pbd/pthread_utils.h +++ b/libs/pbd/pbd/pthread_utils.h @@ -87,6 +87,7 @@ LIBPBD_API int pbd_pthread_create ( LIBPBD_API int pbd_realtime_pthread_create ( + std::string const& debug_name, const int policy, int priority, const size_t stacksize, pthread_t *thread, void *(*start_routine) (void *), diff --git a/libs/pbd/pthread_utils.cc b/libs/pbd/pthread_utils.cc index 721de0a728..6a72a284ca 100644 --- a/libs/pbd/pthread_utils.cc +++ b/libs/pbd/pthread_utils.cc @@ -396,6 +396,7 @@ pbd_absolute_rt_priority (int policy, int priority) int pbd_realtime_pthread_create ( + std::string const& debug_name, const int policy, int priority, const size_t stacksize, pthread_t* thread, void* (*start_routine) (void*), @@ -416,7 +417,7 @@ pbd_realtime_pthread_create ( if (stacksize > 0) { pthread_attr_setstacksize (&attr, stacksize + pbd_stack_size ()); } - DEBUG_TRACE (PBD::DEBUG::Threads, string_compose ("Start Realtime Thread policy = %1 priority = %2 stacksize = 0x%3%4\n", policy, parm.sched_priority, std::hex, stacksize)); + DEBUG_TRACE (PBD::DEBUG::Threads, string_compose ("Start RT Thread: '%1' policy = %2 priority = %3 stacksize = 0x%4%5\n", debug_name, policy, parm.sched_priority, std::hex, stacksize)); rv = pthread_create (thread, &attr, start_routine, arg); pthread_attr_destroy (&attr);