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

RW ()

Construct an unlocked mutex.

~RW ()

Destroy an unlocked mutex.

RW ::scoped_lock::acquire(RW&, bool write=true)

Acquire lock on mutex.

RW ::scoped_lock::release( )

Release lock.

bool RW::scoped_lock::upgrade_to_writer( )

Change reader lock to writer lock.

bool RW::scoped_lock::downgrade_to_reader( )

Change writer lock to reader lock.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.175.180