Пример #1
0
        public void ExitShared()
        {
            var id = Guid.NewGuid();

            idLock.EnterShared(id);
            idLock.ExitShared(id);
            Assert.IsFalse(idLock.SharedLockTakenBy(id));
        }
 private void SharedWorker()
 {
     try
     {
         startEvent.Wait();
         for (int j = 0; j < iterations; j++)
         {
             if (errorToken.Token.IsCancellationRequested)
             {
                 return;
             }
             Guid id = Guid.NewGuid();
             idLock.EnterShared(id);
             SetProtectedValue();
             idLock.ExitShared(id);
         }
     }
     catch
     {
         errorToken.Cancel();
     }
 }