• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<title>Frequently Asked Questions</title>
6<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
8<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
9<link rel="up" href="../signals2.html" title="Chapter 35. Boost.Signals2">
10<link rel="prev" href="thread-safety.html" title="Thread-Safety">
11<link rel="next" href="rationale.html" title="Design Rationale">
12</head>
13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
14<table cellpadding="2" width="100%"><tr>
15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
16<td align="center"><a href="../../../index.html">Home</a></td>
17<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
20<td align="center"><a href="../../../more/index.htm">More</a></td>
21</tr></table>
22<hr>
23<div class="spirit-nav">
24<a accesskey="p" href="thread-safety.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../signals2.html"><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="rationale.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
25</div>
26<div class="section">
27<div class="titlepage"><div><div><h2 class="title" style="clear: both">
28<a name="signals2.faq"></a>Frequently Asked Questions</h2></div></div></div>
29<div class="qandaset">
30<a name="id-1.3.36.8.2"></a><dl>
31<dt>1. <a href="faq.html#id-1.3.36.8.2.1">Don't noncopyable signal semantics mean that a class
32        with a signal member will be noncopyable as well?</a>
33</dt>
34<dt>2. <a href="faq.html#id-1.3.36.8.2.2">Is Boost.Signals2 thread-safe?</a>
35</dt>
36</dl>
37<table border="0" style="width: 100%;">
38<colgroup>
39<col align="left" width="1%">
40<col>
41</colgroup>
42<tbody>
43<tr class="question">
44<td align="left" valign="top">
45<a name="id-1.3.36.8.2.1"></a><a name="id-1.3.36.8.2.1.1"></a><p><b>1.</b></p>
46</td>
47<td align="left" valign="top"><p>Don't noncopyable signal semantics mean that a class
48        with a signal member will be noncopyable as well?</p></td>
49</tr>
50<tr class="answer">
51<td align="left" valign="top"></td>
52<td align="left" valign="top"><p>No. The compiler will not be able to generate a copy
53        constructor or copy assignment operator for your class if it
54        has a signal as a member, but you are free to write your own
55        copy constructor and/or copy assignment operator. Just don't
56        try to copy the signal.</p></td>
57</tr>
58<tr class="question">
59<td align="left" valign="top">
60<a name="id-1.3.36.8.2.2"></a><a name="id-1.3.36.8.2.2.1"></a><p><b>2.</b></p>
61</td>
62<td align="left" valign="top"><p>Is Boost.Signals2 thread-safe?</p></td>
63</tr>
64<tr class="answer">
65<td align="left" valign="top"></td>
66<td align="left" valign="top">
67<p>
68          Yes, as long as the Mutex template parameter is not set to
69          a fake mutex type like <code class="computeroutput"><a class="link" href="../boost/signals2/dummy_mutex.html" title="Class dummy_mutex">boost::signals2::dummy_mutex</a></code>.
70          Also, if your slots depend on objects which may be destroyed concurrently
71          with signal invocation, you will need to use automatic connection management.
72          That is, the objects will need to be owned by
73          <code class="computeroutput">shared_ptr</code> and passed to the slot's
74          <code class="computeroutput"><a class="link" href="../boost/signals2/slot.html#id-1_3_36_6_12_5_1_1_17_1-bb">track</a></code>() method before the slot is connected.
75          The <code class="computeroutput"><a class="link" href="../boost/signals2/trackable.html" title="Class trackable">signals2::trackable</a></code> scheme of automatic connection management
76          is NOT thread-safe, and is only provided to ease porting of single-threaded
77          code from Boost.Signals to Boost.Signals2.
78        </p>
79<p>See the documentation section on <a class="link" href="thread-safety.html" title="Thread-Safety">thread-safety</a>
80          for more information.
81        </p>
82</td>
83</tr>
84</tbody>
85</table>
86</div>
87</div>
88<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
89<td align="left"><p><small>Last revised: June 12, 2007 at 14:01:23 -0400</small></p></td>
90<td align="right"><div class="copyright-footer">Copyright © 2001-2004 Douglas Gregor<br>Copyright © 2007-2009 Frank Mori Hess<p>Distributed under the Boost
91    Software License, Version 1.0. (See accompanying file
92    <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>
93</div></td>
94</tr></table>
95<hr>
96<div class="spirit-nav">
97<a accesskey="p" href="thread-safety.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../signals2.html"><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="rationale.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
98</div>
99</body>
100</html>
101