Emit Signal when MCSS Threads are exhausted

By default Windows has limit of 32 MMCSS threads.
Ardour uses MMCSS scheduling for for hardware I/O (audio and MIDI)
as well as for realtime process threads, and a user on a
recent machine may run into this limit.
This commit is contained in:
Robin Gareus 2025-08-16 21:10:17 +02:00
parent cf14fe75f2
commit 92bcddb437
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 7 additions and 0 deletions

View file

@ -24,6 +24,7 @@
#include <string>
#include "pbd/signals.h"
#include "pbd/libpbd_visibility.h"
namespace PBD {
@ -55,6 +56,8 @@ bool LIBPBD_API revert_thread_characteristics (HANDLE task_handle);
bool LIBPBD_API set_thread_priority (HANDLE, AVRT_PRIORITY);
extern Signal<void()> MMCSSError;
} // namespace MMCSS
} // namespace PBD

View file

@ -41,6 +41,8 @@ namespace PBD {
namespace MMCSS {
Signal<void()> MMCSSError;
bool
initialize ()
{
@ -133,6 +135,8 @@ set_thread_characteristics (const std::string& task_name, HANDLE* task_handle)
DEBUG_THREADS("MMCSS: Privilege not held\n");
break;
default:
/* this is likely because the maximum number of MMCSS threads has been reached */
MMCSSError (); /* EMIT SIGNAL */
DEBUG_THREADS("MMCSS: Unknown error setting thread characteristics\n");
break;
}