public void Wait(TimeSpan timeout) { lock (this) { Monitor.Wait(this, timeout, false); } //return mutex.WaitOne(timeout, false); }
/// <summary> /// Waits forever for the latch to be completed /// <summary> public bool await() { lock (mutex) { TimeSpan elapsed = new TimeSpan(0, 0, 5); while (remaining > 0) { mutex.Wait(elapsed); } } return(true); }