public IAsyncResult BeginStop(AsyncCallback callback, object state) { Interlocked.Increment(ref mAsyncActiveStopCount); ManagerStopDelegate d = new ManagerStopDelegate(this.Stop); if (this.mAsyncActiveStopEvent == null) { lock (ASYNC_BEGIN_LOCK) { if (this.mAsyncActiveStopEvent == null) { this.mAsyncActiveStopEvent = new AutoResetEvent(true); } } } this.mAsyncActiveStopEvent.WaitOne(); this.mStopDelegate = d; return(d.BeginInvoke(callback, state)); }
public ManagerStateEnum EndStop(IAsyncResult asyncResult) { if (asyncResult == null) { ThrowHelper.ThrowArgumentNullException("asyncResult"); } if (this.mStopDelegate == null) { ThrowHelper.ThrowArgumentException("Wrong async result or EndStop called multiple times.", "asyncResult"); } try { return(this.mStopDelegate.EndInvoke(asyncResult)); } finally { this.mStopDelegate = null; this.mAsyncActiveStopEvent.Set(); CloseAsyncActiveStopEvent(Interlocked.Decrement(ref mAsyncActiveStopCount)); } }
public ManagerStateEnum EndStop(IAsyncResult asyncResult) { if (asyncResult == null) { ThrowHelper.ThrowArgumentNullException("asyncResult"); } if (this.mStopDelegate == null) { ThrowHelper.ThrowArgumentException("Wrong async result or EndStop called multiple times.", "asyncResult"); } try { return this.mStopDelegate.EndInvoke(asyncResult); } finally { this.mStopDelegate = null; this.mAsyncActiveStopEvent.Set(); CloseAsyncActiveStopEvent(Interlocked.Decrement(ref mAsyncActiveStopCount)); } }
public IAsyncResult BeginStop(AsyncCallback callback, object state) { Interlocked.Increment(ref mAsyncActiveStopCount); ManagerStopDelegate d = new ManagerStopDelegate(this.Stop); if (this.mAsyncActiveStopEvent == null) { lock (ASYNC_BEGIN_LOCK) { if (this.mAsyncActiveStopEvent == null) { this.mAsyncActiveStopEvent = new AutoResetEvent(true); } } } this.mAsyncActiveStopEvent.WaitOne(); this.mStopDelegate = d; return d.BeginInvoke(callback, state); }