System.Threading.ReaderWriterLockSlim.WaitOnEvent C# (CSharp) Method

WaitOnEvent() private method

Waits on 'waitEvent' with a timeout of 'millisceondsTimeout. Before the wait 'numWaiters' is incremented and is restored before leaving this routine.
private WaitOnEvent ( EventWaitHandle waitEvent, uint &numWaiters, int millisecondsTimeout ) : bool
waitEvent EventWaitHandle
numWaiters uint
millisecondsTimeout int
return bool
		bool WaitOnEvent (EventWaitHandle waitEvent, ref uint numWaiters, int millisecondsTimeout)
		{
			Debug.Assert (MyLockHeld);

			waitEvent.Reset ();
			numWaiters++;

			bool waitSuccessful = false;

			// Do the wait outside of any lock 
			ExitMyLock();      
			try {
				waitSuccessful = waitEvent.WaitOne (millisecondsTimeout, false);
			} finally {
				EnterMyLock ();
				--numWaiters;
				if (!waitSuccessful)
					ExitMyLock ();
			}
			return waitSuccessful;
		}