Blame view

3rdparty/boost_1_81_0/doc/html/signals2/faq.html 5.6 KB
e6ccf0ce   Hu Chunming   提交三方库
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
  <!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=UTF-8">
  <title>Frequently Asked Questions</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.html" title="Chapter 34. Boost.Signals2">
  <link rel="prev" href="thread-safety.html" title="Thread-Safety">
  <link rel="next" href="rationale.html" title="Design Rationale">
  </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="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>
  </div>
  <div class="section">
  <div class="titlepage"><div><div><h2 class="title" style="clear: both">
  <a name="signals2.faq"></a>Frequently Asked Questions</h2></div></div></div>
  <div class="qandaset">
  <a name="id-1.3.35.8.2"></a><dl>
  <dt>1. <a href="faq.html#id-1.3.35.8.2.1">Don't noncopyable signal semantics mean that a class
          with a signal member will be noncopyable as well?</a>
  </dt>
  <dt>2. <a href="faq.html#id-1.3.35.8.2.2">Is Boost.Signals2 thread-safe?</a>
  </dt>
  </dl>
  <table border="0" style="width: 100%;">
  <colgroup>
  <col align="left" width="1%">
  <col>
  </colgroup>
  <tbody>
  <tr class="question">
  <td align="left" valign="top">
  <a name="id-1.3.35.8.2.1"></a><a name="id-1.3.35.8.2.1.1"></a><p><b>1.</b></p>
  </td>
  <td align="left" valign="top"><p>Don't noncopyable signal semantics mean that a class
          with a signal member will be noncopyable as well?</p></td>
  </tr>
  <tr class="answer">
  <td align="left" valign="top"></td>
  <td align="left" valign="top"><p>No. The compiler will not be able to generate a copy
          constructor or copy assignment operator for your class if it
          has a signal as a member, but you are free to write your own
          copy constructor and/or copy assignment operator. Just don't
          try to copy the signal.</p></td>
  </tr>
  <tr class="question">
  <td align="left" valign="top">
  <a name="id-1.3.35.8.2.2"></a><a name="id-1.3.35.8.2.2.1"></a><p><b>2.</b></p>
  </td>
  <td align="left" valign="top"><p>Is Boost.Signals2 thread-safe?</p></td>
  </tr>
  <tr class="answer">
  <td align="left" valign="top"></td>
  <td align="left" valign="top">
  <p>
            Yes, as long as the Mutex template parameter is not set to
            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>.
            Also, if your slots depend on objects which may be destroyed concurrently
            with signal invocation, you will need to use automatic connection management.
            That is, the objects will need to be owned by
            <code class="computeroutput"><a class="link" href="../boost/shared_ptr.html" title="Class template shared_ptr">shared_ptr</a></code> and passed to the slot's
            <code class="computeroutput"><a class="link" href="../boost/signals2/slot.html#id-1_3_35_6_12_5_1_1_17_1-bb">track</a></code>() method before the slot is connected.
            The <code class="computeroutput"><a class="link" href="../boost/signals2/trackable.html" title="Class trackable">signals2::trackable</a></code> scheme of automatic connection management
            is NOT thread-safe, and is only provided to ease porting of single-threaded
            code from Boost.Signals to Boost.Signals2.
          </p>
  <p>See the documentation section on <a class="link" href="thread-safety.html" title="Thread-Safety">thread-safety</a>
            for more information.
          </p>
  </td>
  </tr>
  </tbody>
  </table>
  </div>
  </div>
  <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  <td align="left"><p><small>Last revised: June 12, 2007 at 14:01:23 -0400</small></p></td>
  <td align="right"><div class="copyright-footer">Copyright © 2001-2004 Douglas Gregor<br>Copyright © 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="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>
  </div>
  </body>
  </html>