ReaderWriterMutex Concept
The ReaderWriterMutex Concept extends the Mutex Concept to include the notion of reader-writer locks. It introduces a Boolean parameter, write, that specifies whether a writer lock (write = true) or reader lock (write = false) is being requested. Multiple reader locks can be held simultaneously on a ReaderWriterMutex if it does not have a writer lock on it. A writer lock on a ReaderWriterMutex excludes all other tasks from holding a lock on the mutex at the same time.
Table 7-3 shows the requirements for ReaderWriterMutexRW.
Table 7-3. ReaderWriterMutex Concept
|
Pseudosignature |
Semantics |
|---|---|
|
|
Construct an unlocked mutex. |
|
|
Destroy an unlocked mutex. |
|
|
Acquire lock on mutex. |
|
|
Release lock. |
|
|
Change reader lock to writer lock. |
|
|
Change writer lock to reader lock. |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access