LockAsync() public method

Returns a lock right away or waits asynchronously until a lock is available.
public LockAsync ( string operationName ) : System.Threading.Tasks.Task
operationName string
return System.Threading.Tasks.Task
Esempio n. 1
0
 public async Task AsyncLock_ThrowsIfNotInitialized()
 {
     string lockFilePath = Path.Combine(PathHelper.TestLockPath, "uninitialized.lock");
     LockFile uninitialized = new LockFile(lockFilePath, NullTracerFactory.Instance);
     await Assert.ThrowsAsync<InvalidOperationException>(() => uninitialized.LockAsync("operationName"));
 }
Esempio n. 2
0
 public void AsyncLock_ThrowsIfNotInitialized()
 {
     string lockFilePath = Path.Combine(PathHelper.TestLockPath, "uninitialized.lock");
     LockFile uninitialized = new LockFile(lockFilePath, NullTracerFactory.Instance, new FileSystem());
     Assert.Throws<InvalidOperationException>(() => uninitialized.LockAsync());
 }