예제 #1
0
        /// <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);
        }
예제 #2
0
 public AutoSignal this[string name]
 {
     get
     {
         AutoSignal signal;
         lock (table)
         {
             signal = table[name] as AutoSignal;
             if (signal == null)
             {
                 table[name] = signal = new AutoSignal();
             }
         }
         return(signal);
     }
 }