Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LockHandleSet" /> class for the given set of keys.
 /// </summary>
 public LockHandleSet(LockSet <TKey> locks, IEnumerable <LockHandle> handles)
 {
     Contract.Requires(locks != null);
     Contract.Requires(handles != null);
     _locks   = locks;
     _handles = handles;
 }
Exemplo n.º 2
0
 private LockHandle(LockHandle lockHandle, TimeSpan lockAcquisitionDuration)
 {
     _locks = lockHandle._locks;
     TaskCompletionSource = lockHandle.TaskCompletionSource;
     Key       = lockHandle.Key;
     _handleId = lockHandle._handleId;
     LockAcquisitionDuration = lockAcquisitionDuration;
 }
Exemplo n.º 3
0
            /// <summary>
            /// Initializes a new instance of the <see cref="LockHandle" /> struct for the given collection/key.
            /// </summary>
            public LockHandle(LockSet <TKey> locks, TKey key)
            {
                Contract.Requires(locks != null);
                Contract.Requires(key != null);

                TaskCompletionSource = TaskSourceSlim.Create <ValueUnit>();
                _locks    = locks;
                Key       = key;
                _handleId = Interlocked.Increment(ref _currentHandleId);
            }