From 1ca57823966c54e870c5bf7d2c22390392731e04 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 2 Feb 2025 22:17:53 +1000 Subject: [PATCH] Threading: Handle EINTR on sem_wait() --- src/common/threading.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/threading.cpp b/src/common/threading.cpp index 6081342b0..1f401a887 100644 --- a/src/common/threading.cpp +++ b/src/common/threading.cpp @@ -670,7 +670,11 @@ void Threading::KernelSemaphore::Wait() #elif defined(__APPLE__) semaphore_wait(m_sema); #else - sem_wait(&m_sema); + do + { + if (sem_wait(&m_sema) == 0) [[likely]] + return; + } while (errno == EINTR); #endif }