Stop() public method

Stop the current timeout from further execution. Once a timeout is stopped it can not be restarted
public Stop ( ) : void
return void
示例#1
0
文件: AppHost.cs 项目: kersny/manos
        public static Timeout AddTimeout(TimeSpan begin, TimeSpan timespan, IRepeatBehavior repeat, object data, TimeoutCallback callback)
        {
            Timeout t = new Timeout(begin, timespan, repeat, data, callback);

            ITimerWatcher timer;

            timer = context.CreateTimerWatcher(begin, timespan, delegate {
                t.Run(app);
                if (!t.ShouldContinueToRepeat())
                {
                    t.Stop();
                    timer.Dispose();
                }
            });

            timer.Start();

            return(t);
        }
示例#2
0
文件: AppHost.cs 项目: hlesesne/manos
        public static Timeout AddTimeout(TimeSpan begin, TimeSpan timespan, IRepeatBehavior repeat, object data, TimeoutCallback callback)
        {
            Timeout t = new Timeout (begin, timespan, repeat, data, callback);

            ITimerWatcher timer = null;
            timer = context.CreateTimerWatcher (begin, timespan, delegate {
                t.Run (app);
                if (!t.ShouldContinueToRepeat ()) {
                    t.Stop ();
                    timer.Dispose ();
                }
            });

            timer.Start ();

            return t;
        }