private int ReleaseCore(int releaseCount) { // The field value is modifiable via the public <see cref="WaitHandle.SafeWaitHandle"/> property, save it locally // to ensure that one instance is used in all places in this method SafeWaitHandle waitHandle = SafeWaitHandle; if (waitHandle.IsInvalid) { ThrowInvalidHandleException(); } waitHandle.DangerousAddRef(); try { return(WaitSubsystem.ReleaseSemaphore(waitHandle.DangerousGetHandle(), releaseCount)); } finally { waitHandle.DangerousRelease(); } }
private void ReleaseCore(int count) { WaitSubsystem.ReleaseSemaphore(_semaphore, count); }
private static int ReleaseCore(IntPtr handle, int releaseCount) { return(WaitSubsystem.ReleaseSemaphore(handle, releaseCount)); }