示例#1
0
        static void OnTimerComplete(object state)
        {
            AsyncWaiter     waiter     = (AsyncWaiter)state;
            AsyncWaitHandle thisPtr    = waiter.Parent;
            bool            callWaiter = false;

            lock (thisPtr.syncObject)
            {
                // If still in the waiting list (that means it hasn't been signaled)
                if (thisPtr.asyncWaiters != null && thisPtr.asyncWaiters.Remove(waiter))
                {
                    waiter.TimedOut = true;
                    callWaiter      = true;
                }
            }

            waiter.CancelTimer();

            if (callWaiter)
            {
                waiter.Call();
            }
        }
示例#2
0
 public AsyncWaiter(AsyncWaitHandle parent, Action <object, TimeoutException> callback, object state)
 {
     this.Parent   = parent;
     this.callback = callback;
     this.state    = state;
 }
示例#3
0
 public AsyncWaiter(AsyncWaitHandle parent, Action<object, TimeoutException> callback, object state)
 {
     this.Parent = parent;
     this.callback = callback;
     this.state = state;
 }