Ejemplo n.º 1
0
        private 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();
            }
        }
Ejemplo n.º 2
0
 public AsyncWaiter(AsyncWaitHandle parent, Action <object, TimeoutException> callback, object state)
 {
     this.Parent = parent;
     _callback   = callback;
     _state      = state;
 }