Exemple #1
0
 internal LockScopeBuilder(ILockScopeDictionary <TKey> dict)
 {
     _dict       = dict;
     ToRead      = new List <TKey>();
     ToWrite     = new List <TKey>();
     WithTimeout = LockScope.Infinity;
 }
Exemple #2
0
 public static void AssertNotGetWrite <T>(this ILockScopeDictionary <T> dict, params T[] keys)
 {
     InvokeInThread(() =>
     {
         IDisposable scope;
         if (dict.TryGetScope(null, keys, TimeSpan.FromMilliseconds(0), out scope))
         {
             scope.Dispose();
             Assert.Fail("Write was get");
         }
     });
 }
Exemple #3
0
 public static void AssertGetRead <T>(this ILockScopeDictionary <T> dict, params T[] keys)
 {
     InvokeInThread(() =>
     {
         IDisposable scope;
         if (!dict.TryGetScope(keys, null, TimeSpan.FromMilliseconds(0), out scope))
         {
             Assert.Fail("Timeout get read");
         }
         scope.Dispose();
     });
 }
Exemple #4
0
 public static void AssertOff <T>(this ILockScopeDictionary <T> dict, T key)
 {
     Assert.IsFalse(dict.IsWriteHeld(key));
     Assert.IsFalse(dict.IsReadHeld(key));
 }