Ejemplo n.º 1
0
 public WaitAsyncResult(AsyncWaitHandle waitHandle, EventTraceActivity activity, AsyncCallback callback, object state, TimeSpan timeout) : base(callback, state)
 {
     this.waitHandle = waitHandle;
     this.activity   = activity;
     if (this.waitHandle.WaitAsync(BeginEndAsyncWaitHandle.WaitAsyncResult.onWaitCallback, this, timeout))
     {
         base.Complete(true);
     }
 }
Ejemplo n.º 2
0
        private static void OnTimerComplete(object state)
        {
            AsyncWaitHandle.AsyncWaiter asyncWaiter = (AsyncWaitHandle.AsyncWaiter)state;
            AsyncWaitHandle             parent      = asyncWaiter.Parent;
            bool flag = false;

            lock (parent.syncObject)
            {
                if (parent.asyncWaiters != null && parent.asyncWaiters.Remove(asyncWaiter))
                {
                    asyncWaiter.TimedOut = true;
                    flag = true;
                }
            }
            asyncWaiter.CancelTimer();
            if (flag)
            {
                asyncWaiter.Call();
            }
        }
Ejemplo n.º 3
0
 public AsyncWaiter(AsyncWaitHandle parent, Action <object, TimeoutException> callback, object state)
 {
     this.Parent   = parent;
     this.callback = callback;
     this.state    = state;
 }
Ejemplo n.º 4
0
 public BeginEndAsyncWaitHandle()
 {
     this.waitHandle = new AsyncWaitHandle(EventResetMode.AutoReset);
 }