Beispiel #1
0
 private ACL _UnsafeGetACL(int aclID)
 {
     if (idList.TryGetValue(aclID, out ACL aCL))
     {
         return(aCL);
     }
     else
     {   // returns empty ACL!?
         var acl = new ACL();
         acl.Seal();
         return(acl);
     }
 }
Beispiel #2
0
 private int _UnsafeAddId(ACL acl)
 {
     System.Diagnostics.Debug.Assert(locker.IsReadLockHeld || locker.IsUpgradeableReadLockHeld);
     id++;
     aclList.Add(acl, id);
     if (idList.TryAdd(id, acl))
     {
     }
     else
     {
         throw new ArgumentException($"@ ACLSet.GetID Cannot add Duplicate ACE {acl}");
     }
     return(id);
 }
Beispiel #3
0
 public int GetId(ACL acl)
 {
     locker.EnterUpgradeableReadLock();
     try
     {
         return(_UnsafeGetId(acl));
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         locker.ExitUpgradeableReadLock();
     }
 }
Beispiel #4
0
 private int _UnsafeGetId(ACL acl)
 {
     if (aclList.TryGetValue(acl, out int value))
     {
         return(value);
     }
     else
     {
         locker.EnterWriteLock();
         try
         {
             _UnsafeAddId(acl);
             return(id);
         }
         catch (Exception)
         {
             throw;
         }
         finally
         {
             locker.ExitWriteLock();
         }
     }
 }