/// <summary> /// Initializes a new instance. /// </summary> /// <param name="locker">The locker.</param> protected DisposableLock(Locker locker) { _locker = locker; #if DEBUG Waiting(); if(Globals.Timeout.HasValue) { try { EnterLock(Globals.Timeout.Value); } catch (Exception) { #if DEBUG if(_node != null) WaitingLocks.RemoveLock(_node); #endif throw; } Held(); return; } #endif EnterLock(); #if DEBUG Held(); #endif }
/// <summary> /// Initializes a new instance of the <see cref="WriteLock"/> class. /// </summary> /// <param name="locker">The locker.</param> public WriteLock(Locker locker) : base(locker) { }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="locker">The locker.</param> /// <param name="timeout">The timeout.</param> protected DisposableLock(Locker locker, TimeSpan timeout) { _locker = locker; #if DEBUG Waiting(); #endif try { EnterLock(timeout); } catch (Exception) { #if DEBUG if(_node != null) WaitingLocks.RemoveLock(_node); #endif throw; } #if DEBUG Held(); #endif }
/// <summary> /// Initializes a new instance of the <see cref="WriteLock"/> class. /// </summary> /// <param name="locker">The locker.</param> /// <param name="timeout">The timeout.</param> public WriteLock(Locker locker, TimeSpan timeout) : base(locker, timeout) { }
/// <summary> /// Initializes a new instance of the <see cref="UpgradeableReadLock"/> class. /// </summary> /// <param name="locker">The locker.</param> public UpgradeableReadLock(Locker locker) : base(locker) { }
/// <summary> /// Initializes a new instance of the <see cref="UpgradeableReadLock"/> class. /// </summary> /// <param name="locker">The locker.</param> /// <param name="timeout">The timeout.</param> public UpgradeableReadLock(Locker locker, TimeSpan timeout) : base(locker, timeout) { }
/// <summary> /// Initializes a new instance of the <see cref="ReadLock"/> class. /// </summary> /// <param name="locker">The locker.</param> public ReadLock(Locker locker) : base(locker) { }
/// <summary> /// Initializes a new instance of the <see cref="ReadLock"/> class. /// </summary> /// <param name="locker">The locker.</param> /// <param name="timeout">The timeout.</param> public ReadLock(Locker locker, TimeSpan timeout) : base(locker, timeout) { }