Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/doc/html/timed_read_write_mutex.html @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 12.1 KB
Line 
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4<title>Class timed_read_write_mutex</title>
5<link rel="stylesheet" href="boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
7<link rel="start" href="index.html" title="The Boost C++ Libraries">
8<link rel="up" href="threads/reference.html#id693680" title="Header &lt;boost/thread/read_write_mutex.hpp&gt;">
9<link rel="prev" href="try_read_write_mutex.html" title="Class try_read_write_mutex">
10<link rel="next" href="thread.html" title="Class thread">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%">
14<td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../boost.png"></td>
15<td align="center"><a href="../../index.htm">Home</a></td>
16<td align="center"><a href="../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="../../people/people.htm">People</a></td>
18<td align="center"><a href="../../more/faq.htm">FAQ</a></td>
19<td align="center"><a href="../../more/index.htm">More</a></td>
20</table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="try_read_write_mutex.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="threads/reference.html#id693680"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="thread.html"><img src="images/next.png" alt="Next"></a>
24</div>
25<div class="refentry" lang="en">
26<a name="timed_read_write_mutex"></a><div class="titlepage"></div>
27<div class="refnamediv">
28<h2><span class="refentrytitle">Class timed_read_write_mutex</span></h2>
29<p>boost::timed_read_write_mutex &#8212; <p>The <a href="timed_read_write_mutex.html" title="Class timed_read_write_mutex">timed_read_write_mutex</a> class is a model of the
30                        <a href="threads/concepts.html#threads.concepts.TimedReadWriteMutex" title="TimedReadWriteMutex Concept">TimedReadWriteMutex</a> concept.</p></p>
31</div>
32<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
33<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis">
34<span class="bold"><strong>class</strong></span> timed_read_write_mutex {
35<span class="bold"><strong>public</strong></span>:
36  <span class="emphasis"><em>// types</em></span>
37  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_read_write_lock;      
38  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_try_read_write_lock;  
39  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_timed_read_write_lock;
40  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_read_lock;            
41  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_try_read_lock;        
42  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_timed_read_lock;      
43  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_write_lock;           
44  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_try_write_lock;       
45  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_timed_write_lock;     
46
47  <span class="emphasis"><em>// <a href="timed_read_write_mutex.html#timed_read_write_mutexconstruct-copy-destruct">construct/copy/destruct</a></em></span>
48  <a href="timed_read_write_mutex.html#id894380-bb">timed_read_write_mutex</a>(boost::read_write_scheduling_policy);
49  <a href="timed_read_write_mutex.html#id999914-bb">~timed_read_write_mutex</a>();
50};</pre></div>
51<div class="refsect1" lang="en">
52<a name="id1562699"></a><h2>Description</h2>
53<p>The <a href="timed_read_write_mutex.html" title="Class timed_read_write_mutex">timed_read_write_mutex</a> class is a model of the
54                        <a href="threads/concepts.html#threads.concepts.TimedReadWriteMutex" title="TimedReadWriteMutex Concept">TimedReadWriteMutex</a> concept.
55                        It should be used to synchronize access to shared resources using
56                        <a href="threads/concepts.html#threads.concepts.read-write-locking-strategies.unspecified" title="Unspecified Locking Strategy">Unspecified</a>
57                        locking mechanics.</p>
58<p>For classes that model related mutex concepts, see
59                        <a href="read_write_mutex.html" title="Class read_write_mutex">read_write_mutex</a> and <a href="try_read_write_mutex.html" title="Class try_read_write_mutex">try_read_write_mutex</a>.</p>
60<p>The <a href="timed_read_write_mutex.html" title="Class timed_read_write_mutex">timed_read_write_mutex</a> class supplies the following typedefs,
61                        which <a href="threads/concepts.html#threads.concepts.read-write-lock-models" title="Lock Models">model</a>
62                        the specified locking strategies:
63
64                        </p>
65<div class="informaltable"><table class="table">
66<colgroup>
67<col>
68<col>
69</colgroup>
70<thead><tr>
71<th align="left">Lock Name</th>
72<th align="left">Lock Concept</th>
73</tr></thead>
74<tbody>
75<tr>
76<td align="left">scoped_read_write_lock</td>
77<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedReadWriteLock" title="ScopedReadWriteLock Concept">ScopedReadWriteLock</a></td>
78</tr>
79<tr>
80<td align="left">scoped_try_read_write_lock</td>
81<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedTryReadWriteLock" title="ScopedTryReadWriteLock Expressions">ScopedTryReadWriteLock</a></td>
82</tr>
83<tr>
84<td align="left">scoped_timed_read_write_lock</td>
85<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedTimedReadWriteLock" title="ScopedTimedReadWriteLock Concept">ScopedTimedReadWriteLock</a></td>
86</tr>
87<tr>
88<td align="left">scoped_read_lock</td>
89<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedLock" title="ScopedLock Concept">ScopedLock</a></td>
90</tr>
91<tr>
92<td align="left">scoped_try_read_lock</td>
93<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedTryLock" title="ScopedTryLock Concept">ScopedTryLock</a></td>
94</tr>
95<tr>
96<td align="left">scoped_timed_read_lock</td>
97<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedTimedLock" title="ScopedTimedLock Concept">ScopedTimedLock</a></td>
98</tr>
99<tr>
100<td align="left">scoped_write_lock</td>
101<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedLock" title="ScopedLock Concept">ScopedLock</a></td>
102</tr>
103<tr>
104<td align="left">scoped_try_write_lock</td>
105<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedTryLock" title="ScopedTryLock Concept">ScopedTryLock</a></td>
106</tr>
107<tr>
108<td align="left">scoped_timed_write_lock</td>
109<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedTimedLock" title="ScopedTimedLock Concept">ScopedTimedLock</a></td>
110</tr>
111</tbody>
112</table></div>
113<p>The <a href="timed_read_write_mutex.html" title="Class timed_read_write_mutex">timed_read_write_mutex</a> class uses an
114                        <a href="threads/concepts.html#threads.concepts.read-write-locking-strategies.unspecified" title="Unspecified Locking Strategy">Unspecified</a>
115                        locking strategy, so attempts to recursively lock a <a href="timed_read_write_mutex.html" title="Class timed_read_write_mutex">timed_read_write_mutex</a>
116                        object or attempts to unlock one by threads that don't own a lock on it result in
117                        <span class="bold"><strong>undefined behavior</strong></span>.
118                        This strategy allows implementations to be as efficient as possible
119                        on any given platform. It is, however, recommended that
120                        implementations include debugging support to detect misuse when
121                        <code class="computeroutput">NDEBUG</code> is not defined.</p>
122<p>Like all
123                        <a href="threads/concepts.html#threads.concepts.read-write-mutex-models" title="Mutex Models">read/write mutex models</a>
124                        in , <a href="timed_read_write_mutex.html" title="Class timed_read_write_mutex">timed_read_write_mutex</a> has two types of
125                        <a href="threads/concepts.html#threads.concepts.read-write-scheduling-policies" title="Scheduling Policies">scheduling policies</a>, an
126                        <a href="threads/concepts.html#threads.concepts.read-write-scheduling-policies.inter-class" title="Inter-Class Scheduling Policies">inter-class sheduling policy</a>
127                        between threads trying to obtain different types of locks and an
128                        <a href="threads/concepts.html#threads.concepts.read-write-scheduling-policies.intra-class" title="Intra-Class Scheduling Policies">intra-class sheduling policy</a>
129                        between threads trying to obtain the same type of lock.
130                        The <a href="timed_read_write_mutex.html" title="Class timed_read_write_mutex">timed_read_write_mutex</a> class allows the
131                        programmer to choose what
132                        <a href="threads/concepts.html#threads.concepts.read-write-scheduling-policies.inter-class" title="Inter-Class Scheduling Policies">inter-class sheduling policy</a>
133                        will be used; however, like all read/write mutex models,
134                        <a href="timed_read_write_mutex.html" title="Class timed_read_write_mutex">timed_read_write_mutex</a> leaves the
135                        <a href="threads/concepts.html#threads.concepts.read-write-scheduling-policies.intra-class" title="Intra-Class Scheduling Policies">intra-class sheduling policy</a> as
136                        <a href="threads/concepts.html#threads.concepts.unspecified-scheduling-policy" title="Unspecified Policy">Unspecified</a>.                     
137                        </p>
138<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
139<h3 class="title">Note</h3>Self-deadlock is virtually guaranteed if a thread tries to
140                        lock the same <a href="timed_read_write_mutex.html" title="Class timed_read_write_mutex">timed_read_write_mutex</a> multiple times
141                        unless all locks are read-locks (but see below)</div>
142<div class="refsect2" lang="en">
143<a name="id1563031"></a><h3>
144<a name="timed_read_write_mutexconstruct-copy-destruct"></a><code class="computeroutput">timed_read_write_mutex</code> construct/copy/destruct</h3>
145<div class="orderedlist"><ol type="1">
146<li>
147<pre class="literallayout"><a name="id894380-bb"></a>timed_read_write_mutex(boost::read_write_scheduling_policy count);</pre>
148<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>:
149
150    Constructs a <a href="timed_read_write_mutex.html" title="Class timed_read_write_mutex">timed_read_write_mutex</a> object.
151                        <br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Postconditions</span></b>:
152
153    <code class="computeroutput">*this</code> is in an unlocked state.
154                        </p>
155</li>
156<li>
157<pre class="literallayout"><a name="id999914-bb"></a>~timed_read_write_mutex();</pre>
158<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>:
159
160    Destroys a <a href="timed_read_write_mutex.html" title="Class timed_read_write_mutex">timed_read_write_mutex</a> object.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Requires</span></b>:
161
162    <code class="computeroutput">*this</code> is in an unlocked state.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Notes</span></b>:
163
164    <span class="bold"><strong>Danger:</strong></span> Destruction of a
165                        locked mutex is a serious programming error resulting in undefined
166                        behavior such as a program crash.</p>
167</li>
168</ol></div>
169</div>
170</div>
171</div>
172<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
173<td align="left"></td>
174<td align="right"><small>Copyright © 2001-2003 William E. Kempf</small></td>
175</tr></table>
176<hr>
177<div class="spirit-nav">
178<a accesskey="p" href="try_read_write_mutex.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="threads/reference.html#id693680"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="thread.html"><img src="images/next.png" alt="Next"></a>
179</div>
180</body>
181</html>
Note: See TracBrowser for help on using the repository browser.