public void TestWriteLockTimeout() { using (ILockStrategy l = LockFactory.Create()) using (new ThreadedWriter(l)) using (WriteLock w = new WriteLock(l, 0)) Assert.IsFalse(w.HasWriteLock); }
/// <summary> /// Returns a read and write lock /// </summary> /// <exception cref="System.TimeoutException"/> public WriteLock Write(int timeout) { return(WriteLock.Acquire(this, timeout)); }
/// <summary> /// Returns a read and write lock /// </summary> public WriteLock Write() { return(WriteLock.Acquire(this, -1)); }
/// <summary> /// Returns a read and write lock /// </summary> /// <exception cref="System.TimeoutException"/> public WriteLock Write(int millisecondsTimeout) { return(WriteLock.Acquire(this, millisecondsTimeout)); }
public void TestIdiotWriterUsesDispose() { using (ILockStrategy l = LockFactory.Create()) using (WriteLock w = new WriteLock(l, 0)) { Assert.IsTrue(w.HasWriteLock); ((IDisposable)w).Dispose(); //You cannot do this, the using statement has a 'copy' of ReadLock, don't call dispose. } }
public void TestWriteLockSuccess() { using (ILockStrategy l = LockFactory.Create()) using (WriteLock w = new WriteLock(l, 0)) Assert.IsTrue(w.HasWriteLock); }