Ejemplo n.º 1
0
            public SwitchReadWriteLock(ReadWriteLock rwLock, bool isSharing)
            {
                m_rwLock = rwLock;
                m_isRead = isSharing;

                if (m_isRead)
                {
                    m_rwLock.EnterReadLock();
                }
                else
                {
                    m_rwLock.EnterWriteLock();
                }
            }
Ejemplo n.º 2
0
 public static IDisposable GetReadLock(this ReadWriteLock readWriteLock)
 {
     readWriteLock.EnterReadLock();
     return(new DisposableAction(() => readWriteLock.ExitReadLock()));
 }