/// <summary> /// Lock read @lock. /// </summary> public void AcquireReadLock() { if (ThreadLogUtil.ENABLED_TRACE) { ThreadLogUtil.TraceLock(ACQUIRE_TEXT + " read ", _lock); } _readLock = _lock.ReadLock.Acquire(); if (ThreadLogUtil.ENABLED_TRACE) { ThreadLogUtil.TraceLock(ACQUIRED_TEXT + " read ", _lock); } }
/// <summary> /// Lock write @lock. /// </summary> public void AcquireWriteLock() { if (ThreadLogUtil.ENABLED_TRACE) { ThreadLogUtil.TraceLock(ACQUIRE_TEXT + " write ", _lock); } _writeLock = _lock.WriteLock.Acquire(); if (ThreadLogUtil.ENABLED_TRACE) { ThreadLogUtil.TraceLock(ACQUIRED_TEXT + " write ", _lock); } }
public bool AcquireWriteLock(long msecTimeout) { if (ThreadLogUtil.ENABLED_TRACE) { ThreadLogUtil.TraceLock(ACQUIRE_TEXT + " write ", _lock); } _writeLock = _lock.WriteLock.Acquire(msecTimeout); if (ThreadLogUtil.ENABLED_TRACE) { ThreadLogUtil.TraceLock(ACQUIRED_TEXT + " write ", _lock); } return true; }
/// <summary> /// Unlock write @lock. /// </summary> public void ReleaseWriteLock() { if (ThreadLogUtil.ENABLED_TRACE) { ThreadLogUtil.TraceLock(RELEASE_TEXT + " write ", _lock); } if (_writeLock == null) { throw new EPLockException("writeLock was not acquired"); } _writeLock.Dispose(); _writeLock = null; if (ThreadLogUtil.ENABLED_TRACE) { ThreadLogUtil.TraceLock(RELEASED_TEXT + " write ", _lock); } }