protected OpenCountFileSystem(ref ReferenceCountedDisposable <IFileSystem> baseFileSystem, ref ReferenceCountedDisposable <IEntryOpenCountSemaphoreManager> entryCountSemaphore, ref IUniqueLock mountCountSemaphore) : base(ref baseFileSystem) { Shared.Move(out _entryCountSemaphore, ref entryCountSemaphore); Shared.Move(out _mountCountSemaphore, ref mountCountSemaphore); }
public static ReferenceCountedDisposable <IFileSystem> CreateShared( ref ReferenceCountedDisposable <IFileSystem> baseFileSystem, ref ReferenceCountedDisposable <IEntryOpenCountSemaphoreManager> entryCountSemaphore, ref IUniqueLock mountCountSemaphore) { var filesystem = new OpenCountFileSystem(ref baseFileSystem, ref entryCountSemaphore, ref mountCountSemaphore); return(new ReferenceCountedDisposable <IFileSystem>(filesystem)); }
public static Result MakeUniqueLockWithPin <T>(out IUniqueLock uniqueLock, SemaphoreAdaptor semaphore, ref ReferenceCountedDisposable <T> objectToPin) where T : class, IDisposable { UnsafeHelpers.SkipParamInit(out uniqueLock); UniqueLockSemaphore tempUniqueLock = default; try { Result rc = TryAcquireCountSemaphore(out tempUniqueLock, semaphore); if (rc.IsFailure()) { return(rc); } uniqueLock = new UniqueLockWithPin <T>(ref tempUniqueLock, ref objectToPin); return(Result.Success); } finally { tempUniqueLock.Dispose(); } }