public SafeWriterSemaphoreRelease(DebuggableSemaphoreSlim objLastSemaphore, DebuggableSemaphoreSlim objCurrentSemaphore, DebuggableSemaphoreSlim objNextSemaphore, AsyncFriendlyReaderWriterLock objReaderWriterLock)
 {
     if (objCurrentSemaphore == null)
     {
         throw new ArgumentNullException(nameof(objCurrentSemaphore));
     }
     if (objNextSemaphore == null)
     {
         throw new ArgumentNullException(nameof(objNextSemaphore));
     }
     if (objLastSemaphore == objCurrentSemaphore)
     {
         throw new InvalidOperationException(
                   "Last and current semaphores are identical, this should not happen.");
     }
     if (objCurrentSemaphore == objNextSemaphore)
     {
         throw new InvalidOperationException(
                   "Current and next semaphores are identical, this should not happen.");
     }
     if (objLastSemaphore == objNextSemaphore)
     {
         throw new InvalidOperationException(
                   "Last and next semaphores are identical, this should not happen.");
     }
     _objLastSemaphore    = objLastSemaphore;
     _objCurrentSemaphore = objCurrentSemaphore;
     _objNextSemaphore    = objNextSemaphore;
     _objReaderWriterLock = objReaderWriterLock;
 }
 public SafeWriterSemaphoreRelease(SemaphoreSlim objCurrentWriterSemaphore, SemaphoreSlim objNextWriterSemaphore, AsyncFriendlyReaderWriterLock objReaderWriterLock)
 {
     _objCurrentWriterSemaphore = objCurrentWriterSemaphore;
     _objNextWriterSemaphore    = objNextWriterSemaphore;
     _objReaderWriterLock       = objReaderWriterLock;
 }
Beispiel #3
0
 private EnterReadLock(AsyncFriendlyReaderWriterLock rwlMyLock)
 {
     _rwlMyLock = rwlMyLock;
 }
Beispiel #4
0
        public static ValueTask <EnterReadLock> EnterAsync(IHasLockObject rwlMyLockCarrier, CancellationToken token = default)
        {
            AsyncFriendlyReaderWriterLock rwlMyLock = rwlMyLockCarrier.LockObject;

            return(EnterAsync(rwlMyLock, token));
        }
Beispiel #5
0
        public static async ValueTask <EnterReadLock> EnterAsync(AsyncFriendlyReaderWriterLock rwlMyLock, CancellationToken token = default)
        {
            await rwlMyLock.EnterReadLockAsync(token).ConfigureAwait(false);

            return(new EnterReadLock(rwlMyLock));
        }
Beispiel #6
0
 public static EnterReadLock Enter(AsyncFriendlyReaderWriterLock rwlMyLock, CancellationToken token = default)
 {
     rwlMyLock.EnterReadLock(token);
     return(new EnterReadLock(rwlMyLock));
 }