コード例 #1
0
        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);
            }
        }
コード例 #2
0
        private async Task <Guid> ResetAndReadLockIdAsync()
        {
            DistributedLockManager.LockBarrier();

            await Task.Delay(0); //just to force us to yield.

            return(await ReadLockIdAsync());
        }
コード例 #3
0
        private Guid ResetAndReadLockId()
        {
            DistributedLockManager.LockBarrier();

            return(ReadLockId());
        }