summaryrefslogtreecommitdiff
path: root/doc/html/boost/signals2/shared_connection_block.html
blob: 9acd9e1c6f642a1b2aeff6103e449ee847a909e0 (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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Class shared_connection_block</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../signals2/reference.html#header.boost.signals2.shared_connection_block_hpp" title="Header &lt;boost/signals2/shared_connection_block.hpp&gt;">
<link rel="prev" href="optional_last_idp719737328.html" title="Class optional_last_value&lt;void&gt;">
<link rel="next" href="signal.html" title="Class template signal">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="optional_last_idp719737328.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../signals2/reference.html#header.boost.signals2.shared_connection_block_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="signal.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.signals2.shared_connection_block"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class shared_connection_block</span></h2>
<p>boost::signals2::shared_connection_block &#8212; Blocks a connection between a signal and a slot.</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="comment">// In header: &lt;<a class="link" href="../../signals2/reference.html#header.boost.signals2.shared_connection_block_hpp" title="Header &lt;boost/signals2/shared_connection_block.hpp&gt;">boost/signals2/shared_connection_block.hpp</a>&gt;

</span>
<span class="keyword">class</span> <a class="link" href="shared_connection_block.html" title="Class shared_connection_block">shared_connection_block</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// <a class="link" href="shared_connection_block.html#boost.signals2.shared_connection_blockconstruct-copy-destruct">construct/copy/destruct</a></span>
  <a class="link" href="shared_connection_block.html#idp719763104-bb"><span class="identifier">shared_connection_block</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="connection.html" title="Class connection">boost::signals2::connection</a> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">connection</span><span class="special">(</span><span class="special">)</span><span class="special">,</span> 
                          <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="shared_connection_block.html#idp719774656-bb"><span class="identifier">shared_connection_block</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">signals2</span><span class="special">::</span><span class="identifier">shared_connection_block</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  shared_connection_block&amp; 
  <a class="link" href="shared_connection_block.html#idp719781296-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">signals2</span><span class="special">::</span><span class="identifier">shared_connection_block</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="shared_connection_block.html#idp719779792-bb"><span class="special">~</span><span class="identifier">shared_connection_block</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="shared_connection_block.html#idp719786960-bb">connection blocking</a></span>
  <span class="keyword">void</span> <a class="link" href="shared_connection_block.html#idp719787520-bb"><span class="identifier">unblock</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="shared_connection_block.html#idp719791152-bb"><span class="identifier">block</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="shared_connection_block.html#idp719794272-bb"><span class="identifier">blocking</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="shared_connection_block.html#idp719800320-bb">miscellaneous methods</a></span>
  <a class="link" href="connection.html" title="Class connection">boost::signals2::connection</a> <a class="link" href="shared_connection_block.html#idp719800880-bb"><span class="identifier">connection</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idp523085920"></a><h2>Description</h2>
<p>A <code class="computeroutput">shared_connection_block</code> object blocks a
          connection, preventing the associated slot from executing when the
          associated signal is invoked. The connection will remain
          blocked until every <code class="computeroutput">shared_connection_block</code> that references
          the connection
          releases its block.  A <code class="computeroutput">shared_connection_block</code> releases
          its block when it is destroyed or its
          <a class="link" href="shared_connection_block.html#idp719787520-bb">unblock</a> method is called.</p>
<p>A <code class="computeroutput">shared_connection_block</code> is safe to use even
          after the <a class="link" href="connection.html" title="Class connection">signals2::connection</a> object it was constructed
          from has been destroyed, or the connection it references has been
          disconnected.</p>
<p>
            Note, blocking a connection does not guarantee the associated slot
            has finished execution if it is already in the process of being run
            when the connection block goes into effect.  This is similar
            to the behaviour of disconnect, in that blocking a connection
            will not wait for the connection's associated slot to complete execution.
            This situation may arise in a multi-threaded environment if the
            connection block goes into effect concurrently with signal invocation,
            or in a single-threaded environment if a slot blocks its own
            connection.
          </p>
<div class="refsect2">
<a name="idp523093344"></a><h3>
<a name="boost.signals2.shared_connection_blockconstruct-copy-destruct"></a><code class="computeroutput">shared_connection_block</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="idp719763104-bb"></a><span class="identifier">shared_connection_block</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="connection.html" title="Class connection">boost::signals2::connection</a> <span class="special">&amp;</span> conn <span class="special">=</span> <span class="identifier">connection</span><span class="special">(</span><span class="special">)</span><span class="special">,</span> 
                        <span class="keyword">bool</span> initially_blocking <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Effects:</span></p></td>
<td>
<p>Creates a <code class="computeroutput">shared_connection_block</code> which can block
            the connection referenced by <code class="computeroutput">conn</code>.  The <code class="computeroutput">shared_connection_block</code>
            will initially block the connection if and only if the
            <code class="computeroutput">initially_blocking</code>
            parameter is <code class="computeroutput">true</code>.  The block on the connection may be released
            by calling the <a class="link" href="shared_connection_block.html#idp719787520-bb">unblock</a> method,
            or destroying the <code class="computeroutput">shared_connection_block</code> object.</p>
<p>Default construction of a <code class="computeroutput">shared_connection_block</code> results in a
              <code class="computeroutput">shared_connection_block</code> which references the NULL connection.
              Such a <code class="computeroutput">shared_connection_block</code> is safe to use, though not
              particularly useful until it is assigned another
              <code class="computeroutput">shared_connection_block</code> which references a real connection.
            </p>
</td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput">this-&gt;blocking() == initially_blocking</code></p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><a name="idp719774656-bb"></a><span class="identifier">shared_connection_block</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">signals2</span><span class="special">::</span><span class="identifier">shared_connection_block</span> <span class="special">&amp;</span> other<span class="special">)</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Effects:</span></p></td>
<td><p>
              Copy constructs a <code class="computeroutput">shared_connection_block</code> which references
              the same connection as <code class="computeroutput">other</code>.
            </p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td>
<p><code class="computeroutput">this-&gt;connection() == other.connection()</code></p>
<p><code class="computeroutput">this-&gt;blocking() == other.blocking()</code></p>
</td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout">shared_connection_block&amp; 
<a name="idp719781296-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">signals2</span><span class="special">::</span><span class="identifier">shared_connection_block</span> <span class="special">&amp;</span> rhs<span class="special">)</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Effects:</span></p></td>
<td><p>
              Makes <code class="computeroutput">this</code> reference the same connection as <code class="computeroutput">rhs</code>.
            </p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td>
<p><code class="computeroutput">this-&gt;connection() == rhs.connection()</code></p>
<p><code class="computeroutput">this-&gt;blocking() == rhs.blocking()</code></p>
</td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td><p>Will not throw.</p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><a name="idp719779792-bb"></a><span class="special">~</span><span class="identifier">shared_connection_block</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Effects:</span></p></td>
<td><p>If <a class="link" href="shared_connection_block.html#idp719794272-bb">blocking</a>() is true, releases the connection block.</p></td>
</tr></tbody>
</table></div>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idp523151392"></a><h3>
<a name="idp719786960-bb"></a><code class="computeroutput">shared_connection_block</code> connection blocking</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idp719787520-bb"></a><span class="identifier">unblock</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Effects:</span></p></td>
<td><p>If <a class="link" href="shared_connection_block.html#idp719794272-bb">blocking</a>() is true, releases the connection block.
              Note, the connection may remain blocked due to
              other <code class="computeroutput">shared_connection_block</code> objects.</p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput">this-&gt;blocking() == false</code>.</p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idp719791152-bb"></a><span class="identifier">block</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Effects:</span></p></td>
<td><p>If <a class="link" href="shared_connection_block.html#idp719794272-bb">blocking</a>() is false, reasserts a block on
              the connection.</p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput">this-&gt;blocking() == true</code>.</p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idp719794272-bb"></a><span class="identifier">blocking</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p><code class="computeroutput">true</code> if <code class="computeroutput">this</code> is asserting a block on the connection.</p></td>
</tr>
<tr>
<td><p><span class="term">Notes:</span></p></td>
<td><p><code class="computeroutput">this-&gt;blocking() == true</code> implies <code class="computeroutput"><a class="link" href="connection.html#idp719451600-bb">connection::blocked</a>() == true</code>
            for the connection.  However, <code class="computeroutput">this-&gt;blocking() == false</code> does not necessarily imply
            <code class="computeroutput">connection::blocked() == false</code>, since the connection may be
            blocked by another <code class="computeroutput">shared_connection_block</code> object.</p></td>
</tr>
</tbody>
</table></div>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idp523183248"></a><h3>
<a name="idp719800320-bb"></a><code class="computeroutput">shared_connection_block</code> miscellaneous methods</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><a class="link" href="connection.html" title="Class connection">boost::signals2::connection</a> <a name="idp719800880-bb"></a><span class="identifier">connection</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>A connection object for the connection referenced by <code class="computeroutput">this</code>.</p></td>
</tr></tbody>
</table></div>
</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"><div class="copyright-footer">Copyright &#169; 2001-2004 Douglas Gregor<br>Copyright &#169; 2007-2009 Frank Mori Hess<p>Distributed under the Boost
    Software License, Version 1.0. (See accompanying file
    <code class="filename">LICENSE_1_0.txt</code> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="optional_last_idp719737328.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../signals2/reference.html#header.boost.signals2.shared_connection_block_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="signal.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>