Exemplo n.º 1
0
 public static TUpgradeableHandle AcquireUpgradeableReadLock <THandle, TUpgradeableHandle>(IInternalDistributedUpgradeableReaderWriterLock <THandle, TUpgradeableHandle> @lock, TimeSpan?timeout, CancellationToken cancellationToken)
     where THandle : class, IDistributedSynchronizationHandle
     where TUpgradeableHandle : class, IDistributedLockUpgradeableHandle =>
 SyncViaAsync.Run(
     state => AcquireUpgradeableReadLockAsync(state.@lock, state.timeout, state.cancellationToken),
     (@lock, timeout, cancellationToken)
     );
Exemplo n.º 2
0
 public static THandle Acquire <THandle>(IInternalDistributedLock <THandle> @lock, TimeSpan?timeout, CancellationToken cancellationToken)
     where THandle : class, IDistributedSynchronizationHandle =>
 SyncViaAsync.Run(
     state => AcquireAsync(state.@lock, state.timeout, state.cancellationToken),
     (@lock, timeout, cancellationToken)
     );
Exemplo n.º 3
0
 public static THandle?TryAcquire <THandle>(IInternalDistributedReaderWriterLock <THandle> @lock, TimeSpan timeout, CancellationToken cancellationToken, bool isWrite)
     where THandle : class, IDistributedSynchronizationHandle =>
 SyncViaAsync.Run(
     state => [email protected](state.timeout, state.cancellationToken, state.isWrite),
     (@lock, timeout, cancellationToken, isWrite)
     );
Exemplo n.º 4
0
 public static bool TryUpgradeToWriteLock(IDistributedLockUpgradeableHandle handle, TimeSpan timeout, CancellationToken cancellationToken) =>
 SyncViaAsync.Run(t => t.handle.TryUpgradeToWriteLockAsync(t.timeout, t.cancellationToken), (handle, timeout, cancellationToken));