public static Watch StartNew() { Watch watch = new Watch (); watch.Start (); return watch; }
public void TryEnter(int milliSeconds, ref bool lockTaken) { //Thread.BeginCriticalRegion(); Watch sw = Watch.StartNew(); while (sw.ElapsedMilliseconds < milliSeconds) { TryEnter(ref lockTaken); } sw.Stop(); }