From 92bcddb43784a372df2acae5d0acb3b3f7919fb1 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 16 Aug 2025 21:10:17 +0200 Subject: [PATCH] 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. --- libs/pbd/pbd/windows_mmcss.h | 3 +++ libs/pbd/windows_mmcss.cc | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/libs/pbd/pbd/windows_mmcss.h b/libs/pbd/pbd/windows_mmcss.h index 6c61edfbe6..7624bc5022 100644 --- a/libs/pbd/pbd/windows_mmcss.h +++ b/libs/pbd/pbd/windows_mmcss.h @@ -24,6 +24,7 @@ #include +#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 MMCSSError; + } // namespace MMCSS } // namespace PBD diff --git a/libs/pbd/windows_mmcss.cc b/libs/pbd/windows_mmcss.cc index 302d7ed805..396f9e5f2b 100644 --- a/libs/pbd/windows_mmcss.cc +++ b/libs/pbd/windows_mmcss.cc @@ -41,6 +41,8 @@ namespace PBD { namespace MMCSS { +Signal 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; }