System.Threading.ServerWatch.StartNew C# (CSharp) Method

StartNew() public static method

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

Usage Example

Esempio n. 1
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);
        }