Beispiel #1
0
            public SwitchReadWriteLock(ReadWriteLock rwLock, bool isSharing)
            {
                m_rwLock = rwLock;
                m_isRead = isSharing;

                if (m_isRead)
                {
                    m_rwLock.EnterReadLock();
                }
                else
                {
                    m_rwLock.EnterWriteLock();
                }
            }
Beispiel #2
0
 public static IDisposable GetWriteLock(this ReadWriteLock readWriteLock)
 {
     readWriteLock.EnterWriteLock();
     return(new DisposableAction(() => readWriteLock.ExitWriteLock()));
 }