public static ServerWatch StartNew()
        {
            ServerWatch watch = new ServerWatch();

            watch.Start();
            return(watch);
        }
示例#2
0
        public static bool SpinUntil(MyFunc <bool> condition, int millisecondsTimeout)
        {
            ServerSpinWait sw    = new ServerSpinWait();
            ServerWatch    watch = ServerWatch.StartNew();

            while (!condition())
            {
                if (watch.ElapsedMilliseconds > millisecondsTimeout)
                {
                    return(false);
                }
                sw.SpinOnce();
            }

            return(true);
        }
 public static ServerWatch StartNew()
 {
     ServerWatch watch = new ServerWatch ();
     watch.Start ();
     return watch;
 }