Esempio n. 1
0
        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));
        }
Esempio n. 2
0
 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));
     }
 }
Esempio n. 3
0
 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));
     }
 }
Esempio n. 4
0
 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);
 }