1.. _Reader_Writer_Mutexes:
2
3Reader Writer Mutexes
4=====================
5
6
7Mutual exclusion is necessary when at least one thread *writes* to a
8shared variable. But it does no harm to permit multiple readers into a
9protected region. The reader-writer variants of the mutexes, denoted by
10``_rw_`` in the class names, enable multiple readers by distinguishing
11*reader locks* from *writer locks.* There can be more than one reader
12lock on a given mutex.
13
14
15Requests for a reader lock are distinguished from requests for a writer
16lock via an extra boolean parameter in the constructor for
17``scoped_lock``. The parameter is false to request a reader lock and
18true to request a writer lock. It defaults to ``true`` so that when
19omitted, a ``spin_rw_mutex`` or ``queuing_rw_mutex`` behaves like its
20non-``_rw_`` counterpart.
21
22