Author: jinq0123@xxxxxxx Date: Wed Jun 17 18:23:46 2009 New Revision: 270 Modified: trunk/doc/html/signals2/faq.html Log: Signals FAQ Modified: trunk/doc/html/signals2/faq.html ============================================================================== --- trunk/doc/html/signals2/faq.html (original) +++ trunk/doc/html/signals2/faq.html Wed Jun 17 18:23:46 2009 @@ -1,11 +1,11 @@ <html> <head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Frequently Asked Questions</title> <link rel="stylesheet" href="../boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.74.3"><link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
-<link rel="up" href="../signals2.html" title="Chapter 17. Boost.Signals2"> +<link rel="up" href="../signals2.html" title="Chapter 17. Boost.Signals2"> <link rel="prev" href="thread-safety.html" title="Thread-Safety"> <link rel="next" href="rationale.html" title="Design Rationale"> </head> @@ -25,6 +25,10 @@ <div class="section" lang="en"> <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="titlepage"><div><div><h2 class="title" style="clear: both"> +<a name="signals2.faq"></a>常见问题</h2></div></div></div> + <div class="qandaset"> <dl><dt>1. <a href="faq.html#id3385844">Don't noncopyable signal semantics mean that a class
@@ -33,6 +37,15 @@ <dt>2. <a href="faq.html#id3385867">Is Boost.Signals2 thread-safe?</a> </dt> </dl> + +<dl> +<dt>1. <a href="faq.html#id3385844">+ signal 不可复制的语义是否意味着带有 signal 成员的类也是不可复制 的?</a>
+</dt> +<dt>2. <a href="faq.html#id3385867">Boost.Signals2 是否线程安全?</a> +</dt> +</dl> + <table border="0" summary="Q and A Set"> <col align="left" width="1%"> <tbody> @@ -41,7 +54,11 @@ <a name="id3385844"></a><a name="id3385846"></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> + with a signal member will be noncopyable as well?</p> ++ <p>singal 不可复制的语义是否意味着带有 signal 成员的类也是不可复制 的?</p>
+ <p></p> + </td> </tr> <tr class="answer"> <td align="left" valign="top"></td> @@ -49,13 +66,25 @@ 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> + try to copy the signal.</p> + + <p> + 否。如果你的类有个 signal 成员, + 编译器不能为它生成一个复制构造函数或复制赋值操作符, + 但是你可以自己编写复制构造函数和赋值操作符。 + 只是不要试图复制那个 signal。 + </p> + <p></p> + </td> </tr> <tr class="question"> <td align="left" valign="top"> <a name="id3385867"></a><a name="id3385869"></a><p><b>2.</b></p> </td> -<td align="left" valign="top"><p>Is Boost.Signals2 thread-safe?</p></td> +<td align="left" valign="top"><p>Is Boost.Signals2 thread-safe?</p> + <p>Boost.Signals2 是否线程安全?</p> + <p></p> + </td> </tr> <tr class="answer"> <td align="left" valign="top"></td> @@ -72,9 +101,38 @@is NOT thread-safe, and is only provided to ease porting of single-threaded
code from Boost.Signals to Boost.Signals2. </p> + +<p> + 是的,只要 Mutex 模板参数不是被设为像+ <code class="computeroutput"><a class="link" href="../boost/signals2/dummy_mutex.html" title="Class dummy_mutex">boost::signals2::dummy_mutex</a></code>
+ 这样的假互斥体类型。 + + 此外,如果您的插槽依赖的对象 + 可能在信号调用的同时被销毁, + 您将需要使用自动连接管理。 + + 这就是说,在插槽连接之前, + 需要由 + <code class="computeroutput">shared_ptr</code> + 拥有对象,并传递给插槽的+ <code class="computeroutput"><a class="link" href="../boost/signals2/slotN.html#id1187184-bb">track</a></code>()
+ 方法。 + + 自动连接管理的+ <code class="computeroutput"><a class="link" href="../boost/signals2/trackable.html" title="Class trackable">trackable</a></code>
+ 方案不是线程安全的, + 它仅仅用于方便移植单线程代码从 Boost.Signals 到 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> + +<p>详情请参阅文档+ <a class="link" href="thread-safety.html" title="Thread-Safety">线程安全性</a>
+ 一节。 + </p> +<p></p> </td> </tr> </tbody> @@ -83,7 +141,12 @@ </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 +<td align="right"><div class="copyright-footer">Copyright (c) 2001-2004 Douglas Gregor<br>Copyright (c) 2007-2009 Frank Mori Hess
+ + <p>翻译:<a href="http://blog.csdn.net/jq0123";>金庆</a></p> + <p>译文更新:2009.6.18</p> + + <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>