22 std::mutex m_resourceLock;
23 std::mutex m_readersLock;
32 inline void ReaderLock ();
33 inline void ReaderUnlock ();
34 inline void WriterLock ();
35 inline void WriterUnlock ();
46 inline void ReaderWriterLock::ReaderLock ()
48 std::lock_guard< std::mutex > guard( m_readersLock );
50 int prevVal = m_numReaders++;
52 m_resourceLock.lock();
57 inline void ReaderWriterLock::ReaderUnlock ()
59 std::lock_guard< std::mutex > guard( m_readersLock );
61 int curVal = --m_numReaders;
63 m_resourceLock.unlock();
68 inline void ReaderWriterLock::WriterLock ()
70 m_resourceLock.lock();
75 inline void ReaderWriterLock::WriterUnlock ()
77 m_resourceLock.unlock();
Definition: Exception.h:11
Readers-Writers problem solution with readers preference.
Definition: ReaderWriterLock.h:18