summaryrefslogtreecommitdiff
path: root/doc/html/timed_read_write_mutex.html
blob: 5bd039aac041089ecf272ef7e3264316fda81651 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Class timed_read_write_mutex</title>
<link rel="stylesheet" href="boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
<link rel="start" href="index.html" title="The Boost C++ Libraries">
<link rel="up" href="threads/reference.html#id693680" title="Header &lt;boost/thread/read_write_mutex.hpp&gt;">
<link rel="prev" href="try_read_write_mutex.html" title="Class try_read_write_mutex">
<link rel="next" href="thread.html" title="Class thread">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%">
<td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../boost.png"></td>
<td align="center"><a href="../../index.htm">Home</a></td>
<td align="center"><a href="../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="../../people/people.htm">People</a></td>
<td align="center"><a href="../../more/faq.htm">FAQ</a></td>
<td align="center"><a href="../../more/index.htm">More</a></td>
</table>
<hr>
<div class="spirit-nav">
<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>
</div>
<div class="refentry" lang="en">
<a name="timed_read_write_mutex"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class timed_read_write_mutex</span></h2>
<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 
			<a href="threads/concepts.html#threads.concepts.TimedReadWriteMutex" title="TimedReadWriteMutex Concept">TimedReadWriteMutex</a> concept.</p></p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis">
<span class="bold"><strong>class</strong></span> timed_read_write_mutex {
<span class="bold"><strong>public</strong></span>:
  <span class="emphasis"><em>// types</em></span>
  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_read_write_lock;      
  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_try_read_write_lock;  
  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_timed_read_write_lock;
  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_read_lock;            
  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_try_read_lock;        
  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_timed_read_lock;      
  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_write_lock;           
  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_try_write_lock;       
  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>implementation-defined</em></span> scoped_timed_write_lock;     

  <span class="emphasis"><em>// <a href="timed_read_write_mutex.html#timed_read_write_mutexconstruct-copy-destruct">construct/copy/destruct</a></em></span>
  <a href="timed_read_write_mutex.html#id894380-bb">timed_read_write_mutex</a>(boost::read_write_scheduling_policy);
  <a href="timed_read_write_mutex.html#id999914-bb">~timed_read_write_mutex</a>();
};</pre></div>
<div class="refsect1" lang="en">
<a name="id1562699"></a><h2>Description</h2>
<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 
			<a href="threads/concepts.html#threads.concepts.TimedReadWriteMutex" title="TimedReadWriteMutex Concept">TimedReadWriteMutex</a> concept. 
			It should be used to synchronize access to shared resources using
			<a href="threads/concepts.html#threads.concepts.read-write-locking-strategies.unspecified" title="Unspecified Locking Strategy">Unspecified</a>
			locking mechanics.</p>
<p>For classes that model related mutex concepts, see 
			<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>
<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,
			which <a href="threads/concepts.html#threads.concepts.read-write-lock-models" title="Lock Models">model</a>
			the specified locking strategies:

			</p>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th align="left">Lock Name</th>
<th align="left">Lock Concept</th>
</tr></thead>
<tbody>
<tr>
<td align="left">scoped_read_write_lock</td>
<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedReadWriteLock" title="ScopedReadWriteLock Concept">ScopedReadWriteLock</a></td>
</tr>
<tr>
<td align="left">scoped_try_read_write_lock</td>
<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedTryReadWriteLock" title="ScopedTryReadWriteLock Expressions">ScopedTryReadWriteLock</a></td>
</tr>
<tr>
<td align="left">scoped_timed_read_write_lock</td>
<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedTimedReadWriteLock" title="ScopedTimedReadWriteLock Concept">ScopedTimedReadWriteLock</a></td>
</tr>
<tr>
<td align="left">scoped_read_lock</td>
<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedLock" title="ScopedLock Concept">ScopedLock</a></td>
</tr>
<tr>
<td align="left">scoped_try_read_lock</td>
<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedTryLock" title="ScopedTryLock Concept">ScopedTryLock</a></td>
</tr>
<tr>
<td align="left">scoped_timed_read_lock</td>
<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedTimedLock" title="ScopedTimedLock Concept">ScopedTimedLock</a></td>
</tr>
<tr>
<td align="left">scoped_write_lock</td>
<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedLock" title="ScopedLock Concept">ScopedLock</a></td>
</tr>
<tr>
<td align="left">scoped_try_write_lock</td>
<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedTryLock" title="ScopedTryLock Concept">ScopedTryLock</a></td>
</tr>
<tr>
<td align="left">scoped_timed_write_lock</td>
<td align="left"><a href="threads/concepts.html#threads.concepts.ScopedTimedLock" title="ScopedTimedLock Concept">ScopedTimedLock</a></td>
</tr>
</tbody>
</table></div>
<p>The <a href="timed_read_write_mutex.html" title="Class timed_read_write_mutex">timed_read_write_mutex</a> class uses an 
			<a href="threads/concepts.html#threads.concepts.read-write-locking-strategies.unspecified" title="Unspecified Locking Strategy">Unspecified</a>
			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>
			object or attempts to unlock one by threads that don't own a lock on it result in
			<span class="bold"><strong>undefined behavior</strong></span>.
			This strategy allows implementations to be as efficient as possible
			on any given platform. It is, however, recommended that
			implementations include debugging support to detect misuse when
			<code class="computeroutput">NDEBUG</code> is not defined.</p>
<p>Like all
			<a href="threads/concepts.html#threads.concepts.read-write-mutex-models" title="Mutex Models">read/write mutex models</a>
			in , <a href="timed_read_write_mutex.html" title="Class timed_read_write_mutex">timed_read_write_mutex</a> has two types of
			<a href="threads/concepts.html#threads.concepts.read-write-scheduling-policies" title="Scheduling Policies">scheduling policies</a>, an 
			<a href="threads/concepts.html#threads.concepts.read-write-scheduling-policies.inter-class" title="Inter-Class Scheduling Policies">inter-class sheduling policy</a>
			between threads trying to obtain different types of locks and an
			<a href="threads/concepts.html#threads.concepts.read-write-scheduling-policies.intra-class" title="Intra-Class Scheduling Policies">intra-class sheduling policy</a>
			between threads trying to obtain the same type of lock.
			The <a href="timed_read_write_mutex.html" title="Class timed_read_write_mutex">timed_read_write_mutex</a> class allows the
			programmer to choose what
			<a href="threads/concepts.html#threads.concepts.read-write-scheduling-policies.inter-class" title="Inter-Class Scheduling Policies">inter-class sheduling policy</a>
			will be used; however, like all read/write mutex models, 
			<a href="timed_read_write_mutex.html" title="Class timed_read_write_mutex">timed_read_write_mutex</a> leaves the 
			<a href="threads/concepts.html#threads.concepts.read-write-scheduling-policies.intra-class" title="Intra-Class Scheduling Policies">intra-class sheduling policy</a> as 
			<a href="threads/concepts.html#threads.concepts.unspecified-scheduling-policy" title="Unspecified Policy">Unspecified</a>.			
			</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>Self-deadlock is virtually guaranteed if a thread tries to
			lock the same <a href="timed_read_write_mutex.html" title="Class timed_read_write_mutex">timed_read_write_mutex</a> multiple times
			unless all locks are read-locks (but see below)</div>
<div class="refsect2" lang="en">
<a name="id1563031"></a><h3>
<a name="timed_read_write_mutexconstruct-copy-destruct"></a><code class="computeroutput">timed_read_write_mutex</code> construct/copy/destruct</h3>
<div class="orderedlist"><ol type="1">
<li>
<pre class="literallayout"><a name="id894380-bb"></a>timed_read_write_mutex(boost::read_write_scheduling_policy count);</pre>
<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>:

    Constructs 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">Postconditions</span></b>:

    <code class="computeroutput">*this</code> is in an unlocked state.
			</p>
</li>
<li>
<pre class="literallayout"><a name="id999914-bb"></a>~timed_read_write_mutex();</pre>
<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>:

    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>:

    <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>:

    <span class="bold"><strong>Danger:</strong></span> Destruction of a
			locked mutex is a serious programming error resulting in undefined
			behavior such as a program crash.</p>
</li>
</ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><small>Copyright © 2001-2003 William E. Kempf</small></td>
</tr></table>
<hr>
<div class="spirit-nav">
<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>
</div>
</body>
</html>