Example #1
0
 public bool CanWrite(BaseEntry entry)
 {
     lock (_writeLockObject)
     {
         var entryLocker = EntryLockerAccessorFactory.GetEntryLockerAccessor(Operation.Write)(this);
         return(!entryLocker.CheckIsLocked(entry));
     }
 }
Example #2
0
 public bool CanRead(BaseEntry entry)
 {
     lock (_readLockObject)
     {
         var entryLocker = EntryLockerAccessorFactory.GetEntryLockerAccessor(Operation.Read)(this);
         return(!entryLocker.CheckIsLocked(entry));
     }
 }
Example #3
0
            protected LockerOperation(Locker locker, IEnumerable <BaseEntry> entries,
                                      Operation operation)
            {
                _locker    = locker ?? throw new ArgumentNullException(nameof(locker));
                _entries   = entries ?? throw new ArgumentNullException(nameof(entries));
                _operation = operation;

                foreach (var entry in _entries)
                {
                    EntryLockerAccessorFactory.GetEntryLockerAccessor(_operation)(_locker).Lock(entry);
                }
            }
Example #4
0
            public void Dispose()
            {
                if (_isDisposed)
                {
                    return;
                }

                _isDisposed = true;
                foreach (var entry in _entries)
                {
                    EntryLockerAccessorFactory.GetEntryLockerAccessor(_operation)(_locker).Unlock(entry);
                }
            }