diff --git a/src/platform/Darwin/PlatformManagerImpl.cpp b/src/platform/Darwin/PlatformManagerImpl.cpp index 6102d1e599effc..4b82a7460c5fa7 100644 --- a/src/platform/Darwin/PlatformManagerImpl.cpp +++ b/src/platform/Darwin/PlatformManagerImpl.cpp @@ -52,8 +52,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() SuccessOrExit(err); #endif // CHIP_DISABLE_PLATFORM_KVS - mRunLoopSem = dispatch_semaphore_create(0); - // Ensure there is a dispatch queue available static_cast(DeviceLayer::SystemLayer()).SetDispatchQueue(GetWorkQueue()); @@ -127,7 +125,10 @@ void PlatformManagerImpl::_RunEventLoop() // Block on the semaphore till we're signalled to stop by // _StopEventLoopTask() // + mRunLoopSem = dispatch_semaphore_create(0); dispatch_semaphore_wait(mRunLoopSem, DISPATCH_TIME_FOREVER); + dispatch_release(mRunLoopSem); + mRunLoopSem = nullptr; } void PlatformManagerImpl::_Shutdown()