// Called by monitor to see if its lock is held by the current thread. internal bool IsOwnedByCurrentThread() { bool b = MutexHandle.IsOwnedByCurrentThread(handle); GC.KeepAlive(this); return(b); }
//| <include path='docs/doc[@for="MutexHandle.Dispose"]/*' /> protected override void Dispose(bool explicitDisposing) { if (handle.id != 0) { MutexHandle.Dispose(handle); handle = new MutexHandle(); } }
//| <include path='docs/doc[@for="Mutex.Mutex3"]/*' /> public Mutex() { MutexHandle handleOnStack; if (!MutexHandle.Create(false, out handleOnStack)) { throw new HandleCreateException(); } handle = handleOnStack; }
//| <include path='docs/doc[@for="Mutex.Mutex2"]/*' /> public Mutex(bool initiallyOwned) { MutexHandle handleOnStack; if (!MutexHandle.Create(initiallyOwned, out handleOnStack)) { throw new HandleCreateException(); } handle = handleOnStack; }
//| <include path='docs/doc[@for="Mutex.ReleaseMutex"]/*' /> public void ReleaseMutex() { MutexHandle.Release(handle); GC.KeepAlive(this); }