From be6598e224336cf04244e5ab7196a275b1ff0229 Mon Sep 17 00:00:00 2001 From: TellowKrinkle Date: Sun, 27 Nov 2022 15:13:57 -0600 Subject: [PATCH] Threading: DarwinSemaphore.cpp things no longer need to be cancellation points --- common/Darwin/DarwinSemaphore.cpp | 12 +++--------- common/Threading.h | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/common/Darwin/DarwinSemaphore.cpp b/common/Darwin/DarwinSemaphore.cpp index d3642e69bd..3d0c544abb 100644 --- a/common/Darwin/DarwinSemaphore.cpp +++ b/common/Darwin/DarwinSemaphore.cpp @@ -42,16 +42,10 @@ static void MACH_CHECK(kern_return_t mach_retval) { - switch (mach_retval) + if (mach_retval != KERN_SUCCESS) { - case KERN_SUCCESS: - break; - case KERN_ABORTED: // Awoken due reason unrelated to semaphore (e.g. pthread_cancel) - pthread_testcancel(); // Unlike sem_wait, mach semaphore ops aren't cancellation points - // fallthrough - default: - fprintf(stderr, "mach error: %s", mach_error_string(mach_retval)); - assert(mach_retval == KERN_SUCCESS); + fprintf(stderr, "mach error: %s", mach_error_string(mach_retval)); + assert(mach_retval == KERN_SUCCESS); } } diff --git a/common/Threading.h b/common/Threading.h index 908e41d023..57b4ba9187 100644 --- a/common/Threading.h +++ b/common/Threading.h @@ -235,7 +235,7 @@ namespace Threading class UserspaceSemaphore { KernelSemaphore m_sema; - std::atomic m_counter{0}; + std::atomic m_counter{0}; public: UserspaceSemaphore() = default;