public void Abort() { lock (this.ThisLock) { if (!this.aborted) { this.aborted = true; if (this.waiters != null) { while (this.waiters.Count > 0) { AsyncWaitHandle asyncWaitHandle = this.waiters.Dequeue(); asyncWaitHandle.Set(); } } } } }
// Abort the ThreadNeutralSemaphore object. public void Abort() { lock (this.ThisLock) { if (this.aborted) { return; } this.aborted = true; if (this.waiters != null) { while (this.waiters.Count > 0) { AsyncWaitHandle waiter = this.waiters.Dequeue(); waiter.Set(); } } } }
public int Exit() { int num; int num1 = -1; lock (this.ThisLock) { if (!this.aborted) { if (this.count != 0) { if (this.waiters == null || this.waiters.Count == 0) { ThreadNeutralSemaphore threadNeutralSemaphore = this; threadNeutralSemaphore.count = threadNeutralSemaphore.count - 1; num = this.count; } else { AsyncWaitHandle asyncWaitHandle = this.waiters.Dequeue(); num1 = this.count; asyncWaitHandle.Set(); return(num1); } } else { string invalidSemaphoreExit = InternalSR.InvalidSemaphoreExit; throw Fx.Exception.AsError(new SynchronizationLockException(invalidSemaphoreExit)); } } else { num = num1; } } return(num); }