public IAsyncResult BeginStart(AsyncCallback callback, object state) { Interlocked.Increment(ref mAsyncActiveStartCount); ManagerStartDelegate d = new ManagerStartDelegate(this.Start); if (this.mAsyncActiveStartEvent == null) { lock (ASYNC_BEGIN_LOCK) { if (this.mAsyncActiveStartEvent == null) { this.mAsyncActiveStartEvent = new AutoResetEvent(true); } } } this.mAsyncActiveStartEvent.WaitOne(); this.mStartDelegate = d; return(d.BeginInvoke(callback, state)); }
public ManagerStateEnum EndStart(IAsyncResult asyncResult) { if (asyncResult == null) { ThrowHelper.ThrowArgumentNullException("asyncResult"); } if (this.mStartDelegate == null) { ThrowHelper.ThrowArgumentException("Wrong async result or EndStart called multiple times.", "asyncResult"); } try { return(this.mStartDelegate.EndInvoke(asyncResult)); } finally { this.mStartDelegate = null; this.mAsyncActiveStartEvent.Set(); CloseAsyncActiveStartEvent(Interlocked.Decrement(ref mAsyncActiveStartCount)); } }
public ManagerStateEnum EndStart(IAsyncResult asyncResult) { if (asyncResult == null) { ThrowHelper.ThrowArgumentNullException("asyncResult"); } if (this.mStartDelegate == null) { ThrowHelper.ThrowArgumentException("Wrong async result or EndStart called multiple times.", "asyncResult"); } try { return this.mStartDelegate.EndInvoke(asyncResult); } finally { this.mStartDelegate = null; this.mAsyncActiveStartEvent.Set(); CloseAsyncActiveStartEvent(Interlocked.Decrement(ref mAsyncActiveStartCount)); } }
public IAsyncResult BeginStart(AsyncCallback callback, object state) { Interlocked.Increment(ref mAsyncActiveStartCount); ManagerStartDelegate d = new ManagerStartDelegate(this.Start); if (this.mAsyncActiveStartEvent == null) { lock (ASYNC_BEGIN_LOCK) { if (this.mAsyncActiveStartEvent == null) { this.mAsyncActiveStartEvent = new AutoResetEvent(true); } } } this.mAsyncActiveStartEvent.WaitOne(); this.mStartDelegate = d; return d.BeginInvoke(callback, state); }