Skip to Main Content
Intel Threading Building Blocks
book

Intel Threading Building Blocks

by James Reinders
July 2007
Intermediate to advanced content levelIntermediate to advanced
332 pages
10h 4m
English
O'Reilly Media, Inc.
Content preview from Intel Threading Building Blocks

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.

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.
Start your free trial

You might also like

Intel® Xeon Phi™ Coprocessor Architecture and Tools: The Guide for Application Developers

Intel® Xeon Phi™ Coprocessor Architecture and Tools: The Guide for Application Developers

Rezaur Rahman

Publisher Resources

ISBN: 9780596514808Errata Page