/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="timeout"></param> /// <returns></returns> public TestResult WaitForSignal(string name, int timeout) { TimeoutFrame frame = new TimeoutFrame(); AutoSignal signal = signals[name]; signal.Frame = frame; FrameTimer timeoutTimer = new FrameTimer(frame, timeout, new DispatcherOperationCallback(TimeoutFrameOperation), DispatcherPriority.Send); timeoutTimer.Start(); //Pump the dispatcher DispatcherHelper.PushFrame(frame); //abort the operations that did not get processed signal.Frame = null; if (!timeoutTimer.IsCompleted) { timeoutTimer.Stop(); } if (frame.TimedOut) { GlobalLog.LogStatus("A Timeout occurred."); } TestResult result = signal.Result; signal.Reset(); return(result); }
static object TimeoutFrameOperation(object obj) { TimeoutFrame frame = obj as TimeoutFrame; frame.Continue = false; frame.TimedOut = true; return(null); }