示例#1
0
        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));
        }
示例#2
0
 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));
     }
 }
示例#3
0
 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));
     }
 }
示例#4
0
 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);
 }