internal void Wait(object state) { try { WaitHandle[] waits = new WaitHandle[] { _waitObject, _cancelEvent }; do { int signal = WaitHandle.WaitAny(waits, _timeout, false); if (!_unregistered) { lock (this) { _callsInProcess++; } ThreadPool.QueueUserWorkItem(new WaitCallback(DoCallBack), (signal == WaitHandle.WaitTimeout)); } }while (!_unregistered && !_executeOnlyOnce); } catch {} lock (this) { _unregistered = true; if (_callsInProcess == 0 && _finalEvent != null) { NativeEventCalls.SetEvent_internal(_finalEvent.Handle); } } }
internal void Wait(object state) { try { WaitHandle[] waitHandles = new WaitHandle[] { this._waitObject, this._cancelEvent }; do { int num = WaitHandle.WaitAny(waitHandles, this._timeout, false); if (!this._unregistered) { lock (this) { this._callsInProcess++; } ThreadPool.QueueUserWorkItem(new WaitCallback(this.DoCallBack), num == 258); } }while (!this._unregistered && !this._executeOnlyOnce); } catch { } lock (this) { this._unregistered = true; if (this._callsInProcess == 0 && this._finalEvent != null) { NativeEventCalls.SetEvent_internal(this._finalEvent.Handle); } } }
internal void SignalNoCallbacksRunning() { #if !MONO Win32Native.SetEvent(m_notifyWhenNoCallbacksRunning.SafeWaitHandle); #else NativeEventCalls.SetEvent_internal(m_notifyWhenNoCallbacksRunning.SafeWaitHandle.DangerousGetHandle()); #endif }
public bool Set() { lock (this) { CheckDisposed(); return(NativeEventCalls.SetEvent_internal(Handle)); } }
public bool Dispose(WaitHandle notifyObject) { if (notifyObject == null) { throw new ArgumentNullException("notifyObject"); } Dispose(); NativeEventCalls.SetEvent_internal(notifyObject.Handle); return(true); }
private void DoCallBack(object timedOut) { if (this._callback != null) { this._callback(this._state, (bool)timedOut); } lock (this) { this._callsInProcess--; if (this._unregistered && this._callsInProcess == 0 && this._finalEvent != null) { NativeEventCalls.SetEvent_internal(this._finalEvent.Handle); } } }
internal void Wait(object state) { bool release = false; try { _waitObject.SafeWaitHandle.DangerousAddRef(ref release); try { WaitHandle[] waits = new WaitHandle[] { _waitObject, _cancelEvent }; do { int signal = WaitHandle.WaitAny(waits, _timeout, false); if (!_unregistered) { lock (this) { _callsInProcess++; } ThreadPool.QueueUserWorkItem(new WaitCallback(DoCallBack), (signal == WaitHandle.WaitTimeout)); } } while (!_unregistered && !_executeOnlyOnce); } catch { } lock (this) { _unregistered = true; if (_callsInProcess == 0 && _finalEvent != null) { NativeEventCalls.SetEvent_internal(_finalEvent.Handle); } } } catch (ObjectDisposedException) { // Can happen if we called Unregister before we had time to execute Wait if (release) { throw; } } finally { if (release) { _waitObject.SafeWaitHandle.DangerousRelease(); } } }
/// <summary>Sets the state of the event to signaled, allowing one or more waiting threads to proceed.</summary> /// <returns>true if the operation succeeds; otherwise, false.</returns> /// <exception cref="T:System.ObjectDisposedException">The <see cref="M:System.Threading.EventWaitHandle.Close" /> method was previously called on this <see cref="T:System.Threading.EventWaitHandle" />.</exception> /// <filterpriority>2</filterpriority> public bool Set() { base.CheckDisposed(); return(NativeEventCalls.SetEvent_internal(this.Handle)); }
public bool Dispose(WaitHandle notifyObject) { Dispose(); NativeEventCalls.SetEvent_internal(notifyObject.Handle); return(true); }