Threading: DarwinSemaphore.cpp things no longer need to be cancellation points

This commit is contained in:
TellowKrinkle 2022-11-27 15:13:57 -06:00 committed by lightningterror
parent faf750a544
commit be6598e224
2 changed files with 4 additions and 10 deletions

View File

@ -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);
}
}

View File

@ -235,7 +235,7 @@ namespace Threading
class UserspaceSemaphore
{
KernelSemaphore m_sema;
std::atomic<uint32_t> m_counter{0};
std::atomic<int32_t> m_counter{0};
public:
UserspaceSemaphore() = default;