public void ExitExclusive() { var id = Guid.NewGuid(); idLock.EnterExclusive(id); idLock.ExitExclusive(id); Assert.IsFalse(idLock.ExclusiveLockTakenBy(id)); }
private void ExclusiveWorker() { try { startEvent.Wait(); for (int j = 0; j < iterations; j++) { if (errorToken.Token.IsCancellationRequested) { return; } Guid id = Guid.NewGuid(); idLock.EnterExclusive(id); IncrementProtectedValue(); idLock.ExitExclusive(id); } } catch (Exception e) { error = e; errorToken.Cancel(); } }