From fbcd416a848ad049a049d6659bb213ef7a09b49c Mon Sep 17 00:00:00 2001 From: attila Date: Thu, 10 Apr 2025 09:12:48 +0200 Subject: [PATCH] Prevent Thread::sleep waking up on POSIX systems when receiving signals --- modules/juce_core/native/juce_SharedCode_posix.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/juce_core/native/juce_SharedCode_posix.h b/modules/juce_core/native/juce_SharedCode_posix.h index 2525344e09..956b3bc61e 100644 --- a/modules/juce_core/native/juce_SharedCode_posix.h +++ b/modules/juce_core/native/juce_SharedCode_posix.h @@ -55,10 +55,7 @@ void CriticalSection::exit() const noexcept { pthread_mutex_unlock (&loc //============================================================================== void JUCE_CALLTYPE Thread::sleep (int millisecs) { - struct timespec time; - time.tv_sec = millisecs / 1000; - time.tv_nsec = (millisecs % 1000) * 1000000; - nanosleep (&time, nullptr); + std::this_thread::sleep_for (std::chrono::milliseconds (millisecs)); } void JUCE_CALLTYPE Process::terminate()