private void HelperThreadStart() { DistributedLockManager.LockBarrier(); lock (m_Lock) { m_LockManager.TryLock(this, m_Name, m_Timeout, out m_RepositoryLock); if (m_RepositoryLock != null) { Monitor.PulseAll(m_Lock); while (m_Exiting == false) { Monitor.Wait(m_Lock); // Thread waits until we're told to exit. } m_RepositoryLock.Dispose(); // We're exiting, so it's time to release the lock! m_RepositoryLock = null; } // Otherwise, we couldn't get the lock. m_Exited = true; // Lock is released and thread is exiting. Monitor.PulseAll(m_Lock); } }
private async Task <Guid> ResetAndReadLockIdAsync() { DistributedLockManager.LockBarrier(); await Task.Delay(0); //just to force us to yield. return(await ReadLockIdAsync()); }
private Guid ResetAndReadLockId() { DistributedLockManager.LockBarrier(); return(ReadLockId()); }