[boost-doc-zh] r372 committed - 翻译 static_assert, string_algo, thread 库的xml/qbk文件

  • From: boost-doc-zh@xxxxxxxxxxxxxx
  • To: boost-doc-zh-notify@xxxxxxxxxxxxx
  • Date: Sun, 07 Feb 2010 13:35:06 +0000

Revision: 372
Author: alai04
Date: Sun Feb  7 05:34:27 2010
Log: 翻译 static_assert, string_algo, thread 库的xml/qbk文件
http://code.google.com/p/boost-doc-zh/source/detail?r=372

Modified:
 /trunk/glossary/glossary.txt
 /trunk/libs/algorithm/string/doc/concept.xml
 /trunk/libs/algorithm/string/doc/credits.xml
 /trunk/libs/algorithm/string/doc/design.xml
 /trunk/libs/algorithm/string/doc/environment.xml
 /trunk/libs/algorithm/string/doc/intro.xml
 /trunk/libs/algorithm/string/doc/quickref.xml
 /trunk/libs/algorithm/string/doc/rationale.xml
 /trunk/libs/algorithm/string/doc/release_notes.xml
 /trunk/libs/algorithm/string/doc/usage.xml
 /trunk/libs/static_assert/doc/static_assert.qbk
 /trunk/libs/thread/doc/acknowledgements.qbk
 /trunk/libs/thread/doc/barrier.qbk
 /trunk/libs/thread/doc/changes.qbk
 /trunk/libs/thread/doc/condition_variables.qbk
 /trunk/libs/thread/doc/future_ref.qbk
 /trunk/libs/thread/doc/futures.qbk
 /trunk/libs/thread/doc/mutex_concepts.qbk
 /trunk/libs/thread/doc/mutexes.qbk
 /trunk/libs/thread/doc/once.qbk
 /trunk/libs/thread/doc/overview.qbk
 /trunk/libs/thread/doc/shared_mutex_ref.qbk
 /trunk/libs/thread/doc/thread.qbk
 /trunk/libs/thread/doc/thread_ref.qbk
 /trunk/libs/thread/doc/time.qbk
 /trunk/libs/thread/doc/tss.qbk

=======================================
--- /trunk/glossary/glossary.txt        Wed Sep 16 20:25:53 2009
+++ /trunk/glossary/glossary.txt        Sun Feb  7 05:34:27 2010
@@ -147,6 +147,11 @@
  composites                    合成件
  actor                         动作器

+ 9) thread                     //alai04
+ barrier                       栏栅
+ futures                       期货
+ promise                       允诺
+
 f) misc 其它
 rationale              理论注记
                        原理        // jinq
=======================================
--- /trunk/libs/algorithm/string/doc/concept.xml        Mon Dec 28 23:05:14 2009
+++ /trunk/libs/algorithm/string/doc/concept.xml        Sun Feb  7 05:34:27 2010
@@ -8,43 +8,49 @@
 -->

<section id="string_algo.concept" last-revision="$Date: 2008-06-19 08:07:24 -0400 (Thu, 19 Jun 2008) $">
-    <title>Concepts</title>
+    <title>Concepts 概念</title>

     <using-namespace name="boost"/>
     <using-namespace name="boost::algorithm"/>

     <section>
-        <title>Definitions</title>
+        <title>Definitions 定义</title>

         <table>
-            <title>Notation</title>
+            <title>Notation 符号</title>
             <tgroup cols="2" align="left">
                 <tbody>
                     <row>
                         <entry><code>F</code></entry>
-                        <entry>A type that is a model of Finder</entry>
+                        <entry>A type that is a model of Finder<sbr/>
+                        可作为 Finder 的模型的类型</entry>
                     </row>
                     <row>
                         <entry><code>Fmt</code></entry>
-                        <entry>A type that is a model of Formatter</entry>
+                        <entry>A type that is a model of Formatter<sbr/>
+                        可作为 Formatter 的模型的类型</entry>
                     </row>
                     <row>
                         <entry><code>Iter</code></entry>
                         <entry>
-                            Iterator Type
+                            Iterator Type<sbr/>
+                            迭代器类型
                         </entry>
                     </row>
                     <row>
                         <entry><code>f</code></entry>
-                        <entry>Object of type <code>F</code></entry>
+                        <entry>Object of type <code>F</code><sbr/>
+                        类型 <code>F</code> 的对象</entry>
                     </row>
                     <row>
                         <entry><code>fmt</code></entry>
-                        <entry>Object of type <code>Fmt</code></entry>
+                        <entry>Object of type <code>Fmt</code><sbr/>
+                        类型 <code>Fmt</code> 的对象</entry>
                     </row>
                     <row>
                         <entry><code>i,j</code></entry>
-                        <entry>Objects of type <code>Iter</code></entry>
+                        <entry>Objects of type <code>Iter</code><sbr/>
+                        类型 <code>Iter</code> 的对象</entry>
                     </row>
                     </tbody>
             </tgroup>
@@ -52,29 +58,33 @@
     </section>

     <section id="string_algo.finder_concept">
-        <title>Finder Concept</title>
+        <title>Finder Concept 查找器概念</title>

         <para>
Finder is a functor which searches for an arbitrary part of a container. The result of the search is given as an <classname>iterator_range</classname>
-            delimiting the selected part.
+            delimiting the selected part.<sbr/>
+ Finder 是一个搜索某个容器的任意部分的仿函数。搜索的结果以一个限 定所选择的部分的
+            <classname>iterator_range</classname> 的形式给出。
         </para>

         <table>
-            <title>Valid Expressions</title>
+            <title>Valid Expressions 合法表达式</title>
             <tgroup cols="3" align="left">
                 <thead>
                     <row>
-                        <entry>Expression</entry>
-                        <entry>Return Type</entry>
-                        <entry>Effects</entry>
+                        <entry>Expression 表达式 </entry>
+                        <entry>Return Type 返回类型</entry>
+                        <entry>Effects 效果</entry>
                     </row>
                 </thead>
                 <tbody>
                     <row>
                         <entry><code>f(i,j)</code></entry>
- <entry>Convertible to <code>iterator_range&lt;Iter&gt;</code></entry> - <entry>Perform the search on the interval [i,j) and returns the result of the search</entry> + <entry>Convertible to <code>iterator_range&lt;Iter&gt;</code><sbr/> + 可转换为 <code>iterator_range&lt;Iter&gt;</code><Iter> </entry> + <entry>Perform the search on the interval [i,j) and returns the result of the search<sbr/>
+                        在区间 [i,j) 上执行搜索并返回搜索的结果</entry>
                     </row>
                 </tbody>
             </tgroup>
@@ -83,20 +93,26 @@
         <para>
Various algorithms need to perform a search in a container and a Finder is a generalization of such search operations that allows algorithms to abstract from searching. For instance, generic replace - algorithms can replace any part of the input, and the Finder is used to select the desired one. + algorithms can replace any part of the input, and the Finder is used to select the desired one.<sbr/> + 许多算法都需要在一个容器上执行搜索操作,而一个 Finder 就是这种 搜索操作的一个泛化,它允许算法从搜索中抽象出来。 + 例如,通用的替换算法可以替换输入的任何部分,而 Finder 就用来选 择需要的那部分。
         </para>
         <para>
Note, that it is only required that the finder works with a particular iterator type. However, - a Finder operation can be defined as a template, allowing the Finder to work with any iterator. + a Finder operation can be defined as a template, allowing the Finder to work with any iterator.<sbr/> + 注意,Finder 和一种特定的迭代器类型一起工作是仅有的必要条件。然 而,一个 Finder 操作可以定义成一个模板,
+            这样就允许 Finder 可以和任何迭代器一个工作。
         </para>
         <para>
-            <emphasis role="bold">Examples</emphasis>
+            <emphasis role="bold">Examples 示例 </emphasis>
         </para>
         <para>
             <itemizedlist>
                 <listitem>
Finder implemented as a class. This Finder always returns the whole input as a match. <code>operator()</code> - is templated, so that the finder can be used on any iterator type. + is templated, so that the finder can be used on any iterator type.<sbr/> + Finder 实现为一个类。这个 Finder 总是将整个输入作为一个 匹配项返回。 + <code>operator()</code>是模板化的,所以这个 Finder 能够 用于任何迭代器类型

                     <programlisting>
 struct simple_finder
@@ -114,7 +130,9 @@
                 <listitem>
Function Finder. Finder can be any function object. That is, any ordinary function with the required signature can be used as well. However, such a function can be used only for
-                    a specific iterator type.
+                    a specific iterator type. <sbr/>
+ 函数 Finder。Finder 可以成为任何函数对象。也就是说,和 任何带有必要的识别标识的普通函数一样可以使用。
+                    然而,这样一个函数只能用于一种特定的迭代器类型。

                     <programlisting>
 boost::iterator_range&lt;std::string&gt; simple_finder(
@@ -129,7 +147,7 @@
         </para>
     </section>
     <section id="string_algo.formatter_concept">
-        <title>Formatter concept</title>
+        <title>Formatter concept 格式化器概念</title>

         <para>
Formatters are used by <link linkend="string_algo.replace">replace algorithms</link>.
@@ -137,24 +155,30 @@
A formatter is a functor, which takes a result from a Finder operation and transforms it in a specific way. The operation of the formatter can use additional information provided by a specific finder, for example <functionname>regex_formatter()</functionname> uses the match information from - <functionname>regex_finder()</functionname> to format the result of formatter operation. + <functionname>regex_finder()</functionname> to format the result of formatter operation.<sbr/> + Formatters 用于 <link linkend="string_algo.replace">替换算法 </link>。它们通常和 Finder 紧密结合在一起。 + 一个 Formatter 是一个仿函数,它持有一个来自 Finder 的结果并按照 指定的方式对它执行转换。 + Formatter 的运作可以使用由一个指定的 Finder 提供的额外信息,比 如 <functionname>regex_formatter()</functionname> + 使用来自 <functionname>regex_finder()</functionname> 的匹配信息 来格式化 Formatter 操作的结果。
         </para>

         <table>
-            <title>Valid Expressions</title>
+            <title>Valid Expressions 合法表达式</title>
             <tgroup cols="3" align="left">
                 <thead>
                     <row>
-                        <entry>Expression</entry>
-                        <entry>Return Type</entry>
-                        <entry>Effects</entry>
+                        <entry>Expression 表达式 </entry>
+                        <entry>Return Type 返回类型</entry>
+                        <entry>Effects 效果</entry>
                     </row>
                 </thead>
                 <tbody>
                    <row>
                         <entry><code>fmt(f(i,j))</code></entry>
- <entry>A container type, accessible using container traits</entry> - <entry>Formats the result of the finder operation</entry> + <entry>A container type, accessible using container traits<sbr/>
+                        一个容器类型,可使用容器特有的方式访问</entry>
+ <entry>Formats the result of the finder operation<sbr/>
+                        格式化 Finder 操作的结果</entry>
                     </row>
                 </tbody>
             </tgroup>
@@ -163,17 +187,21 @@
         <para>
Similarly to finders, formatters generalize format operations. When a finder is used to select a part of the input, formatter takes this selection and performs some formating - on it. Algorithms can abstract from formating using a formatter. + on it. Algorithms can abstract from formating using a formatter.<sbr/> + 和 Finders 类似,Formatters 泛化了格式化操作。一个 Finder 用于 选择输入的一个部分, + Formatter 持有这个被选择的部分并对它执行某些格式化操作。使用一 个 Formatter 可以将算法从格式化中抽象出来。
         </para>
         <para>
-            <emphasis role="bold">Examples</emphasis>
+            <emphasis role="bold">Examples 示例 </emphasis>
         </para>
         <para>
             <itemizedlist>
                 <listitem>
Formatter implemented as a class. This Formatter does not perform any formating and
                     returns the match, repackaged. <code>operator()</code>
- is templated, so that the Formatter can be used on any Finder type. + is templated, so that the Formatter can be used on any Finder type.<sbr/> + Formatter 实现为一个类。这个 Formatter不执行任何格式化 只返回匹配项并重新打包。 + <code>operator()</code> 是模板化的,所以这个 Formatter 能够用于任何 Finder 类型。

                     <programlisting>
 struct simple_formatter
@@ -189,7 +217,9 @@
                 </listitem>
                 <listitem>
Function Formatter. Similarly to Finder, Formatter can be any function object. - However, as a function, it can be used only with a specific Finder type. + However, as a function, it can be used only with a specific Finder type. <sbr/> + 函数 Formatter。和 Finder 类似,Formatter 可以成为任何 函数对象。然而,作为一个函数,
+                    它只能用于一种特定的 Finder 类型。

                     <programlisting>
std::string simple_formatter( boost::iterator_range&lt;std::string::const_iterator&gt;&amp; Match )
=======================================
--- /trunk/libs/algorithm/string/doc/credits.xml        Mon Dec 28 23:05:14 2009
+++ /trunk/libs/algorithm/string/doc/credits.xml        Sun Feb  7 05:34:27 2010
@@ -8,18 +8,22 @@
 -->

<section id="string_algo.credits" last-revision="$Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $">
-    <title>Credits</title>
+    <title>Credits 荣誉</title>
     <section id="string_algo.ack">
-        <title>Acknowledgments</title>
+        <title>Acknowledgments 致谢</title>
         <para>
The author would like to thank everybody who gave suggestions and comments. Especially valuable were the contributions of Thorsten Ottosen, Jeff Garland and the other boost members who participated in the review process, namely David Abrahams, Daniel Frey, Beman Dawes, John Maddock, David B.Held, Pavel Vozenilek
-            and many other.
+            and many other.<sbr/>
+ 作者希望能感谢给出过建议和意见的每一个人。特别是有价值的是 Thorsten Ottosen, Jeff Garland + 和其他分担了审核任务的 boost 成员,包括 David Abrahams, Daniel Frey, Beman Dawes, John Maddock,
+            David B.Held, Pavel Vozenilek 以及很多其他的人。
         </para>
         <para>
Additional thanks go to Stefan Slapeta and Toon Knapen, who have been very resourceful in solving various
-            portability issues.
+            portability issues.<sbr/>
+ 更多的感谢送给 Stefan Slapeta 和 Toon Knapen,他们在解决各种可 移植性问题时表现出过人的机智。
         </para>
     </section>
 </section>
=======================================
--- /trunk/libs/algorithm/string/doc/design.xml Mon Dec 28 23:05:14 2009
+++ /trunk/libs/algorithm/string/doc/design.xml Sun Feb  7 05:34:27 2010
@@ -9,51 +9,64 @@
 -->

<section id="string_algo.design" last-revision="$Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $">
-    <title>Design Topics</title>
+    <title>Design Topics 设计话题</title>

     <using-namespace name="boost"/>
     <using-namespace name="boost::algorithm"/>

     <section id="string_algo.string">
-        <title>String Representation</title>
+        <title>String Representation 字符串表示法</title>

         <para>
As the name suggest, this library works mainly with strings. However, in the context of this library, a string is not restricted to any particular implementation (like <code>std::basic_string</code>), rather it is a concept. This allows the algorithms in this library to be reused for any string type,
-            that satisfies the given requirements.
+            that satisfies the given requirements.<sbr/>
+ 顾名思义,本库主要是和 strings 一起工作的。然而,在本库的语境 中,一个 string 并不局限于任何特定的实现 + (比如 <code>std::basic_string</code>),而是一个概念。这就允许 本库的算法为任何满足给定要求的 string 类型所复用。
         </para>
         <para>
             <emphasis role="bold">Definition:</emphasis> A string is a
<ulink url="../../libs/range/doc/range.html">range</ulink> of characters accessible in sequential - ordered fashion. Character is any value type with "cheap" copying and assignment. + ordered fashion. Character is any value type with "cheap" copying and assignment. <sbr/> + <emphasis role="bold">定义:</emphasis>一个 string 就是一个可以 用连续有序方式访问的 characters 的 + <ulink url="../../libs/range/doc/range.html">range</ulink>。 Character 是任何带有“廉价”拷贝和赋值操作的值类型。
         </para>
         <para>
First requirement of string-type is that it must accessible using <ulink url="../../libs/range/index.html">Boost.Range</ulink>. This facility allows to access the elements inside the string in a uniform iterator-based fashion.
-            This is sufficient for our library
+            This is sufficient for our library<sbr/>
+ string-type 的第一个要求是必须可以用 <ulink url="../../libs/range/index.html">Boost.Range</ulink> 访问。 + 这一便利条件允许以一种统一的基于迭代器的方式访问 string 中的元 素。这对于我们的库来说已经足够了。
         </para>
         <para>
Second requirement defines the way in which the characters are stored in the string. Algorithms in this library work with an assumption that copying a character is cheaper then allocating extra storage to cache results. This is a natural assumption for common character types. Algorithms will - work even if this requirement is not satisfied, however at the cost of performance degradation. + work even if this requirement is not satisfied, however at the cost of performance degradation.<sbr/> + 第二个要求清楚地规定了 characters 存储在 string 中的方法。本库 中的算法在工作时假设拷贝一个 character 是比较廉价的, + 并因此分配额外的存储空间以缓存结果。对于常见的 character 类型来 说这是一个正常的假设。 + 即使这个要求没有被满足,算法也可以工作,但要付出性能降低的代 价。
         <para>
         </para>
In addition some algorithms have additional requirements on the string-type. Particularly, it is required that an algorithm can create a new string of the given type. In this case, it is required that - the type satisfies the sequence (Std &sect;23.1.1) requirements. + the type satisfies the sequence (Std &sect;23.1.1) requirements.<sbr/> + 另外,有些算法对 string-type 有额外的要求。特别是,那些可以创建 一个给定类型的新 string 的算法。
+            在这种情况下,它要求这个类型满足序列 (Std §23.1.1) 要求。
         </para>
         <para>
In the reference and also in the code, requirement on the string type is designated by the name of template argument. <code>RangeT</code> means that the basic range requirements must hold. - <code>SequenceT</code> designates extended sequence requirements. + <code>SequenceT</code> designates extended sequence requirements.<sbr/> + 在参考和代码中,对 string 类型的要求通过模板参数的名字表现出 来。<code>RangeT</code> + 意味着基本的 range 要求必须有效。<code>SequenceT</code> 表明扩 展的序列要求。
         </para>
     </section>

     <section id="string_algo.sequence_traits">
-        <title>Sequence Traits</title>
+        <title>Sequence Traits 序列特征</title>

         <para>
The major difference between <code>std::list</code> and <code>std::vector</code> is not in the interfaces
@@ -61,51 +74,62 @@
various operations. The problem is that it is not possible to infer this difference from the
             definitions of classes without some special mechanism.
However, some algorithms can run significantly faster with the knowledge of the properties
-            of a particular container.
+            of a particular container.<sbr/>
+ <code>std::list</code> 和 <code>std::vector</code> 的最大不同不 在于它们提供的接口, + 而在于类的内部细节以及它执行各种操作的方法。问题是不依靠任何特 殊机制而仅仅通过类的定义不可能推断出这些不同。 + 但是,有些算法在了解了特定容器的性质后运行速度会有大幅度的提 升。
         </para>
         <para>
Sequence traits allow one to specify additional properties of a sequence container (see Std.&sect;32.2). These properties are then used by algorithms to select optimized handling for some operations.
             The sequence traits are declared in the header
- <headername>boost/algorithm/string/sequence_traits.hpp</headername>. + <headername>boost/algorithm/string/sequence_traits.hpp</headername>.<sbr/> + 序列特征允许开发者指定一个序列容器的额外性质(参见 Std §23.2)。因此这些性质可以被算法用来为某些操作选择优化处理。 + 这些序列特性声明在头文件 <headername>boost/algorithm/string/sequence_traits.hpp</headername> 中。
         </para>

         <para>
-            In the table C denotes a container and c is an object of C.
+ In the table C denotes a container and c is an object of C.<sbr/>
+            在下表中,C 表示一个容器,而 c 是 C 的一个对象。
         </para>
         <table>
-            <title>Sequence Traits</title>
+            <title>Sequence Traits 序列特征</title>
             <tgroup cols="2" align="left">
                 <thead>
                     <row>
-                        <entry>Trait</entry>
-                        <entry>Description</entry>
+                        <entry>Trait 特征 </entry>
+                        <entry>Description 说明</entry>
                     </row>
                 </thead>
                 <tbody>
                     <row>
<entry><classname>has_native_replace&lt;C&gt;</classname>::value</entry> - <entry>Specifies that the sequence has std::string like replace method</entry> + <entry>Specifies that the sequence has std::string like replace method<sbr/> + 表明这个序列具有类似 std::string 的替换方法。 </entry>
                     </row>
                     <row>
<entry><classname>has_stable_iterators&lt;C&gt;</classname>::value</entry>
                         <entry>
Specifies that the sequence has stable iterators. It means, that operations like <code>insert</code>/<code>erase</code>/<code>replace</code>
-                            do not invalidate iterators.
+                            do not invalidate iterators.<sbr/>
+                            表明这个序列具有稳定的迭代器。这也就意味着,像
+ <code>insert</code>/<code>erase</code>/<code>replace</code> 这样的操作不会导 致迭代器失效。
                         </entry>
                     </row>
                     <row>
<entry><classname>has_const_time_insert&lt;C&gt;</classname>::value</entry>
                         <entry>
Specifies that the insert method of the sequence has
-                            constant time complexity.
+                            constant time complexity.<sbr/>
+                            表明序列的 insert 方法具有常量时间复杂度。
                         </entry>
                     </row>
                     <row>
<entry><classname>has_const_time_erase&lt;C&gt;</classname>::value</entry>
                         <entry>
- Specifies that the erase method of the sequence has constant time complexity + Specifies that the erase method of the sequence has constant time complexity<sbr/>
+                            表明序列的 erase 方法具有常量时间复杂度。
                         </entry>
                     </row>
                     </tbody>
@@ -114,11 +138,13 @@

         <para>
Current implementation contains specializations for std::list&lt;T&gt; and - std::basic_string&lt;T&gt; from the standard library and SGI's std::rope&lt;T&gt; and std::slist&lt;T&gt;. + std::basic_string&lt;T&gt; from the standard library and SGI's std::rope&lt;T&gt; and std::slist&lt;T&gt;.<sbr/> + 当前实现中包含针对标准库中的 std::list&lt;T&gt; 和 std::basic_string&lt;T&gt;
+            以及 SGI 的 std::rope&lt;T&gt; 和 std::slist&lt;T&gt; 的特化。
         </para>
     </section>
     <section id="string_algo.find">
-        <title>Find Algorithms</title>
+        <title>Find Algorithms 查找算法</title>

         <para>
Find algorithms have similar functionality to <code>std::search()</code> algorithm. They provide a different
@@ -126,16 +152,22 @@
Instead of returning just the start of matching subsequence they return a range which is necessary when the length of the matching subsequence is not known beforehand. This feature also allows a partitioning of the input sequence into three
-            parts: a prefix, a substring and a suffix.
+            parts: a prefix, a substring and a suffix. <sbr/>
+ 查找算法具有与 <code>std::search()</code> 算法类似的功能。它们 提供了一个不同的接口,更适合常用的 string 操作。 + 它们不再仅仅返回匹配子序列的开始位置,而是返回一个 range,这在 事先不知道匹配子序列的长度时是非常必要的。 + 这个特性也允许将输入序列分割为三个部分:一个前缀,一个 substring 和一个后缀。
         </para>
         <para>
- Another difference is an addition of various searching methods besides find_first, including find_regex. + Another difference is an addition of various searching methods besides find_first, including find_regex. <sbr/> + 另一个不同是在 find_first 之外又增加了很多搜索方法,包括 find_regex。
         </para>
         <para>
             It the library, find algorithms are implemented in terms of
<link linkend="string_algo.finder_concept">Finders</link>. Finders are used also by other facilities
             (replace,split).
- For convenience, there are also function wrappers for these finders to simplify find operations. + For convenience, there are also function wrappers for these finders to simplify find operations.<sbr/> + 在本库中,查找算法是实现为 <link linkend="string_algo.finder_concept">Finders</link> 的。 + Finders 也被其它部件 (replace, split) 使用。为便于使用,还有函 数将这些 Finders 包装成简单的查找操作。
         </para>
         <para>
Currently the library contains only naive implementation of find algorithms with complexity
@@ -145,11 +177,15 @@
             provides acceptable efficiency.
Even the C++ standard defines the required complexity for search algorithm as O(n * m). It is possible that a future version of library will also contain algorithms with linear
-            complexity as an option
+            complexity as an option<sbr/>
+ 当前本库只包含了复杂度为 O(n * m) 的查找算法的初级实现,这里的 n 是输入序列的大小,而 m 是搜索序列的大小。 + 要不是因为对于较小的序列来说,常量成本都是相当大的,算法本来可 以带有 O(n) 复杂度。 + 对于小的 m &lt;&lt; n(m 在数量级上比 n 小),当前实现提供了可 以接受的性能。 + 即使在 C++ 标准中为查找算法定义的必要复杂度都是 O(n * m)。在库 的未来版本中,可能会包含可选的线性复杂度的算法。
         </para>
     </section>
     <section id="string_algo.replace">
-        <title>Replace Algorithms</title>
+        <title>Replace Algorithms 替换算法</title>

         <para>
The implementation of replace algorithms follows the layered structure of the library. The
@@ -157,32 +193,44 @@
This layer takes a <link linkend="string_algo.finder_concept">Finder</link> object and a <link linkend="string_algo.formatter_concept">Formatter</link> object as an input. These two functors define what to replace and what to replace it with. The upper layer functions - are just wrapping calls to the lower layer. Finders are shared with the find and split facility. + are just wrapping calls to the lower layer. Finders are shared with the find and split facility. <sbr/> + 替换算法的实现遵循了本库的分层结构。较低的层次实现了通用的对输 入序列中的一个 range 的置换。 + 这个层次用一个 <link linkend="string_algo.finder_concept">Finder</link> 对象和一个 + <link linkend="string_algo.formatter_concept">Formatter</link> 对象作为输入。 + 这两个仿函数规定什么被替换以及用什么来替换。Finders 被查找和分 割部件共享。
         </para>
         <para>
As usual, the implementation of the lower layer is designed to work with a generic sequence while
             taking advantage of specific features if possible
- (by using <link linkend="string_algo.sequence_traits">Sequence traits</link>) + (by using <link linkend="string_algo.sequence_traits">Sequence traits</link>)<sbr/> + 照常,较低层次的实现在尽可能利用特定特性(通过使用 <link linkend="string_algo.sequence_traits">序列特性</link>)
+            的情况下,针对通用序列进行设计。
         </para>
     </section>
     <section id="string_algo.split">
-        <title>Find Iterators &amp; Split Algorithms</title>
+ <title>Find Iterators &amp; Split Algorithms 查找迭代器与分割算法 </title>

         <para>
Find iterators are a logical extension of the <link linkend="string_algo.find">find facility</link>. Instead of searching for one match, the whole input can be iteratively searched for multiple matches. The result of the search is then used to partition the input. It depends on the algorithms which parts are returned as the result. They can be the matching parts (<classname>find_iterator</classname>) of the parts in
-            between (<classname>split_iterator</classname>).
+            between (<classname>split_iterator</classname>). <sbr/>
+ 查找迭代器是 <link linkend="string_algo.find">查找部件</link> 的合理扩展。它不是仅搜索一个匹配项, + 而是迭代地搜索整个输入,以找到多个匹配项。搜索的结果被用来将输 入分割为若干部分。它们可以是匹配的部分 + (<classname>find_iterator</classname>) 也可以是各匹配项之间部 分 (<classname>split_iterator</classname>)。
+            这取决于返回这些部分作为结果的那个算法。
         </para>
         <para>
In addition the split algorithms like <functionname>find_all()</functionname> and <functionname>split()</functionname> can simplify the common operations. They use a find iterator to search the whole input and copy the
-            matches they found into the supplied container.
+            matches they found into the supplied container.<sbr/>
+ 另外,像 <functionname>find_all()</functionname> 和 <functionname>split()</functionname> + 这样的分割算法可以简化常用的操作。它们使用一个查找迭代器去搜索 整个输入并将找到的匹配项拷贝到已提供好的容器中。
         </para>
     </section>
     <section id="string_algo.exception">
-        <title>Exception Safety</title>
+        <title>Exception Safety 异常安全</title>

         <para>
The library requires that all operations on types used as template
@@ -192,32 +240,43 @@
             In other words:
The library maintains its invariants and does not leak resources in
             the face of exceptions.  Some library operations give stronger
-            guarantees, which are documented on an individual basis.
+            guarantees, which are documented on an individual basis.<sbr/>
+ 本库要求对用作模板或函数参数的所有项目提供 <emphasis>基本异常安 全保证</emphasis>。 + 反过来,本库中的所有函数和算法,除非另有说明,都将提供 <emphasis>基本异常安全保证</emphasis>。 + 换句话说:本库在面对异常时,它将保持它的不变量且不泄漏资源。某 些库操作给出更强的保证,
+            这些都被记录到个别的文档中。
         </para>

         <para>
Some functions can provide the <emphasis>strong exception-safety guarantee</emphasis>.
-            That means that following statements are true:
+            That means that following statements are true:    <sbr/>
+ 某些函数可以提供 <emphasis>强异常安全保证</emphasis>。这意味着 以下描述成立:
             <itemizedlist>
                 <listitem>
If an exception is thrown, there are no effects other than those
-                    of the function
+                    of the function <sbr/>
+                    如果抛出一个异常,不会对函数以外产生影响
                 </listitem>
                 <listitem>
- If an exception is thrown other than by the function, there are no effects + If an exception is thrown other than by the function, there are no effects<sbr/>
+                    如果一个异常不是由这个函数抛出的,则没有影响
                 </listitem>
             </itemizedlist>
This guarantee can be provided under the condition that the operations
             on the types used for arguments for these functions either
- provide the strong exception guarantee or do not alter the global state . + provide the strong exception guarantee or do not alter the global state .<sbr/> + 这种保证在这种条件下才会提供:这个操作所针对的类型用作既提供强 异常保证又不改变全局状态的函数的参数。
          </para>
         <para>
In the reference, under the term <emphasis>strong exception-safety guarantee</emphasis>, we mean the
-            guarantee as defined above.
+            guarantee as defined above.   <sbr/>
+ 在参考中,术语 <emphasis>强异常安全保证</emphasis>,就意味着上 面的定义。
         </para>
         <para>
For more information about the exception safety topics, follow this - <ulink url="http://www.boost.org/more/generic_exception_safety.html";>link</ulink> + <ulink url="http://www.boost.org/more/generic_exception_safety.html";>link</ulink><sbr/>
+            关于异常安全话题的更多信息,请参考这个
+ <ulink url="http://www.boost.org/more/generic_exception_safety.html";>连接</ulink>
         </para>
     </section>
 </section>
=======================================
--- /trunk/libs/algorithm/string/doc/environment.xml Mon Dec 28 23:05:14 2009 +++ /trunk/libs/algorithm/string/doc/environment.xml Sun Feb 7 05:34:27 2010
@@ -8,41 +8,50 @@
 -->

<section id="string_algo.env" last-revision="$Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $">
-    <title>Environment</title>
+    <title>Environment 环境</title>
     <section>
-        <title>Build</title>
+        <title>Build 构建</title>
         <para>
The whole library is provided in headers. Regex variants of some algorithms, however, are dependent on the <libraryname>Boost.Regex</libraryname> library. All such algorithms are separated in <headername>boost/algorithm/string_regex.hpp</headername>. If this header is used, the application must be linked with the <libraryname>Boost.Regex</libraryname>
-            library.
+            library. <sbr/>
+ 整个库以头文件方式提供。但是,某些算法的 Regex 变体依赖于 <libraryname>Boost.Regex</libraryname> 库。 + 所有这样的算法都隔离在 <headername>boost/algorithm/string_regex.hpp</headername> 中。 + 如果使用了这个头文件,应用程序必须连接 <libraryname>Boost.Regex</libraryname> 库。
         </para>
     </section>

     <section>
-        <title>Examples</title>
+        <title>Examples 示例</title>
         <para>
Examples showing the basic usage of the library can be found in the libs/algorithm/string/example directory. There is a separate file for the each part of the library. Please follow the boost build guidelines to build examples using the bjam. To successfully build regex examples
-            the <libraryname>Boost.Regex</libraryname> library is required.
+ the <libraryname>Boost.Regex</libraryname> library is required. <sbr/> + 展示本库基本用法的示例放在 libs/algorithm/string/example 目录 中。本库的每一个部分有一个单独的文件。 + 请按照 boost 构建指南使用 bjam 来构建这些示例。若要成功构建 regex 示例,就需要
+            <libraryname>Boost.Regex</libraryname> 库。
         </para>
     </section>

     <section>
-        <title>Tests</title>
+        <title>Tests 测试</title>
         <para>
A full set of test cases for the library is located in the libs/algorithm/string/test directory. The test cases can be executed using the boost build system. For the tests of regular - expression variants of algorithms, the <libraryname>Boost.Regex</libraryname> library is required. + expression variants of algorithms, the <libraryname>Boost.Regex</libraryname> library is required. <sbr/> + 本库的一整套测试用例位于 libs/algorithm/string/test 目录。测试 用例可以用 boost 构建系统执行。 + 对于算法的的正则表达式变体的测试,需要 <libraryname>Boost.Regex</libraryname> 库。
         </para>
     </section>

     <section>
-        <title>Portability</title>
+        <title>Portability 可移植性</title>
         <para>
- The library has been successfully compiled and tested with the following compilers: + The library has been successfully compiled and tested with the following compilers:<sbr/>
+            本库在下列编译器中成功编译并测试:

             <itemizedlist>
                 <listitem>Microsoft Visual C++ 7.0</listitem>
@@ -52,14 +61,19 @@
             </itemizedlist>

See <ulink url="http://boost.sourceforge.net/regression-logs/";>Boost regression tables</ulink>
-            for additional info for a particular compiler.
+            for additional info for a particular compiler.<sbr/>
+            关于特定编译器的更多信息,请参见
+ <ulink url="http://boost.sourceforge.net/regression-logs/";>Boost regression tables</ulink>。
         </para>
         <para>
There are known limitation on platforms not supporting partial template specialization. Library depends on correctly implemented <code>std::iterator_traits</code> class. If a standard library provided with compiler is broken, the String Algorithm Library cannot function properly. Usually it implies that primitive pointer iterators are not
-            working with the library functions.
+            working with the library functions. <sbr/>
+ 在不支持模板偏特化的平台上有已知的限制。本库还依赖正确地实现 <code>std::iterator_traits</code> 类。 + 如果一个编译器附带的标准库有问题,string 算法库就不能完整地实现 其功能。
+            通常这意味着简单的指针迭代器不能和本库函数一起工作。
         </para>
     </section>
 </section>
=======================================
--- /trunk/libs/algorithm/string/doc/intro.xml  Mon Dec 28 23:05:14 2009
+++ /trunk/libs/algorithm/string/doc/intro.xml  Sun Feb  7 05:34:27 2010
@@ -9,21 +9,25 @@
 -->

<section id="string_algo.intro" last-revision="$Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $">
-    <title>Introduction</title>
+    <title>Introduction 简介</title>

     <para>
         The String Algorithm Library provides a generic implementation of
string-related algorithms which are missing in STL. It is an extension to the algorithms library of STL and it includes trimming, case conversion, predicates and find/replace functions. All of them come in different variants
-        so it is easier to choose the best fit for a particular need.
+        so it is easier to choose the best fit for a particular need.<sbr/>
+ string 算法库提供 STL 所缺少的 string 相关算法的通用实现。它是 STL 算法库以及它所包含的修剪,大小写转换, + 判断式和查找/替换函数的扩展。它们全部具有多种不同变化,以便于针对某 一特定需求做出最适当的选择。
     </para>
     <para>
The implementation is not restricted to work with a particular container
         (like <code>std::basic_string</code>), rather it is as generic as
possible. This generalization is not compromising the performance since algorithms are using container specific features when it means a performance
-        gain.
+        gain.<sbr/>
+ 这一实现并不局限于特定的容器(比如 <code>std::basic_string</code>),而是尽可能地通用。 + 这种通用化并不牺牲性能,因为如果容器的特殊特性会增进性能,算法就会 使用这一特性。
     </para>
     <para>
         <emphasis role="bold">
@@ -34,11 +38,17 @@
             although these are most common candidates.
         </emphasis>
Consult the <link linkend="string_algo.design">design chapter</link> to see precise specification of
-        supported string types.
+        supported string types.<sbr/>
+ <emphasis role="bold">特别注意:本文档中我们使用术语 <emphasis>string</emphasis> 指称一个存储在任何容器中的 + <emphasis>characters</emphasis> 的序列。一个 <emphasis>string</emphasis> 并不局限于 <code>std::basic_string</code>, + 而 <emphasis>character</emphasis> 也不一定就是 <code>char</code> 或 <code>wchar_t</code>,虽然这些是最常见的情形。 + </emphasis>请参考 <link linkend="string_algo.design">design章节 </link> 中关于所支持的 string 类型的各种明确的规范。
     </para>
     <para>
The library interface functions and classes are defined in namespace <code>boost::algorithm</code>, and - they are lifted into namespace <code>boost</code> via using declaration. + they are lifted into namespace <code>boost</code> via using declaration.<sbr/> + 本库接口函数和类定义在名字空间 <code>boost::algorithm</code> 中,而 且通过 using 声明,
+        它们也可以生存在名字空间 <code>boost</code> 中。
     </para>
     <para>
The documentation is divided into several sections. For a quick start read the
@@ -49,6 +59,12 @@
provide some explanation about the library design and structure an explain how it should be used. See the <link linkend="string_algo.reference">Reference</link> for the complete list of provided utilities and algorithms. Functions and classes in the reference are organized by the headers in which they are defined. - The reference contains links to the detailed description for every entity in the library. + The reference contains links to the detailed description for every entity in the library.<sbr/> + 本文档分为几个部分。如果想快速开始,可以阅读 <link linkend="string_algo.usage">用法</link> 部分,
+        然后是 <link linkend="string_algo.quickref">快速参考</link>。
+ <link linkend="string_algo.design">设计讨论</link>, <link linkend="string_algo.concept">概念</link> + 和 <link linkend="string_algo.rationale">一些解释</link>提供了关于 库的设计和构造的一些解释, + 以及应该如何使用的说明。关于本库提供的工具和算法的完整列表请参见 <link linkend="string_algo.reference">参考</link>。 + 参考中的函数和类根据定义它们的头文件进行组织。参考中包含一些链 接,可以链到本库中每一个实体的细节描述。
     </para>
 </section>
=======================================
--- /trunk/libs/algorithm/string/doc/quickref.xml       Mon Dec 28 23:05:14 2009
+++ /trunk/libs/algorithm/string/doc/quickref.xml       Sun Feb  7 05:34:27 2010
@@ -8,28 +8,29 @@
 -->

<section id="string_algo.quickref" last-revision="$Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $">
-    <title>Quick Reference</title>
+    <title>Quick Reference 快速参考</title>

     <using-namespace name="boost"/>
     <using-namespace name="boost::algorithm"/>

     <section>
-        <title>Algorithms</title>
+        <title>Algorithms 算法</title>

         <table>
-            <title>Case Conversion</title>
+            <title>Case Conversion 大小写转换</title>
             <tgroup cols="3" align="left">
                 <thead>
                     <row>
-                        <entry>Algorithm name</entry>
-                        <entry>Description</entry>
-                        <entry>Functions</entry>
+                        <entry>Algorithm name 算法名称</entry>
+                        <entry>Description 说明</entry>
+                        <entry>Functions 函数</entry>
                     </row>
                 </thead>
                 <tbody>
                     <row>
                         <entry><code>to_upper</code></entry>
-                        <entry>Convert a string to upper case</entry>
+                        <entry>Convert a string to upper case<sbr/>
+                        将一个 string 转换为大写</entry>
                         <entry>
                             <functionname>to_upper_copy()</functionname>
                             <sbr/>
@@ -38,7 +39,8 @@
                     </row>
                     <row>
                         <entry><code>to_lower</code></entry>
-                        <entry>Convert a string to lower case</entry>
+                        <entry>Convert a string to lower case<sbr/>
+                        将一个 string 转换为小写</entry>
                         <entry>
                             <functionname>to_lower_copy()</functionname>
                             <sbr/>
@@ -49,19 +51,20 @@
             </tgroup>
         </table>
         <table>
-            <title>Trimming</title>
+            <title>Trimming 修剪</title>
             <tgroup cols="3" align="left">
                 <thead>
                     <row>
-                        <entry>Algorithm name</entry>
-                        <entry>Description</entry>
-                        <entry>Functions</entry>
+                        <entry>Algorithm name 算法名称</entry>
+                        <entry>Description 说明</entry>
+                        <entry>Functions 函数</entry>
                     </row>
                 </thead>
                 <tbody>
                     <row>
                         <entry><code>trim_left</code></entry>
-                        <entry>Remove leading spaces from a string</entry>
+                        <entry>Remove leading spaces from a string<sbr/>
+                        从一个 string 中移除开头的空格</entry>
                         <entry>
<functionname>trim_left_copy_if()</functionname>
                             <sbr/>
@@ -74,7 +77,8 @@
                     </row>
                     <row>
                         <entry><code>trim_right</code></entry>
-                        <entry>Remove trailing spaces from a string</entry>
+                        <entry>Remove trailing spaces from a string<sbr/>
+                        从一个 string 中移除末尾的空格</entry>
                         <entry>
<functionname>trim_right_copy_if()</functionname>
                             <sbr/>
@@ -87,7 +91,8 @@
                     </row>
                     <row>
                         <entry><code>trim</code></entry>
- <entry>Remove leading and trailing spaces from a string</entry> + <entry>Remove leading and trailing spaces from a string<sbr/>
+                        从一个 string 中移除开头和末尾的空格</entry>
                         <entry>
                             <functionname>trim_copy_if()</functionname>
                             <sbr/>
@@ -103,19 +108,20 @@
             </tgroup>
         </table>
         <table>
-            <title>Predicates</title>
+            <title>Predicates 判断式</title>
             <tgroup cols="3" align="left">
                 <thead>
                     <row>
-                        <entry>Algorithm name</entry>
-                        <entry>Description</entry>
-                        <entry>Functions</entry>
+                        <entry>Algorithm name 算法名称</entry>
+                        <entry>Description 说明</entry>
+                        <entry>Functions 函数</entry>
                     </row>
                 </thead>
                 <tbody>
                     <row>
                         <entry><code>starts_with</code></entry>
- <entry>Check if a string is a prefix of the other one</entry> + <entry>Check if a string is a prefix of the other one<sbr/>
+                        检查一个 string 是否是另一个的前缀</entry>
                         <entry>
                             <functionname>starts_with()</functionname>
                             <sbr/>
@@ -124,7 +130,8 @@
                     </row>
                     <row>
                         <entry><code>ends_with</code></entry>
- <entry>Check if a string is a suffix of the other one</entry> + <entry>Check if a string is a suffix of the other one<sbr/>
+                        检查一个 string 是否是另一个的后缀</entry>
                         <entry>
                             <functionname>ends_with()</functionname>
                             <sbr/>
@@ -133,7 +140,8 @@
                     </row>
                     <row>
                         <entry><code>contains</code></entry>
- <entry>Check if a string is contained of the other one</entry> + <entry>Check if a string is contained of the other one<sbr/>
+                        检查一个 string 是否被包含于另一个</entry>
                         <entry>
                             <functionname>contains()</functionname>
                             <sbr/>
@@ -142,7 +150,8 @@
                     </row>
                     <row>
                         <entry><code>equals</code></entry>
-                        <entry>Check if two strings are equal</entry>
+                        <entry>Check if two strings are equal<sbr/>
+                        检查两个 strings 是否相等</entry>
                         <entry>
                             <functionname>equals()</functionname>
                             <sbr/>
@@ -151,7 +160,8 @@
                     </row>
                     <row>
                         <entry><code>lexicographical_compare</code></entry>
- <entry>Check if a string is lexicographically less then another one</entry> + <entry>Check if a string is lexicographically less then another one<sbr/> + 根据字典顺序,检查一个 string 是否小于另一个 </entry>
                         <entry>
<functionname>lexicographical_compare()</functionname>
                             <sbr/>
@@ -161,7 +171,8 @@

                     <row>
                         <entry><code>all</code></entry>
- <entry>Check if all elements of a string satisfy the given predicate</entry> + <entry>Check if all elements of a string satisfy the given predicate<sbr/> + 检查一个 string 中的所有元素是否满足指定的判断式 </entry>
                         <entry>
                             <functionname>all()</functionname>
                         </entry>
@@ -170,19 +181,20 @@
             </tgroup>
         </table>
         <table>
-            <title>Find algorithms</title>
+            <title>Find algorithms 查找算法</title>
             <tgroup cols="3" align="left">
                 <thead>
                     <row>
-                        <entry>Algorithm name</entry>
-                        <entry>Description</entry>
-                        <entry>Functions</entry>
+                        <entry>Algorithm name 算法名称</entry>
+                        <entry>Description 说明</entry>
+                        <entry>Functions 函数</entry>
                     </row>
                 </thead>
                 <tbody>
                     <row>
                         <entry>find_first</entry>
- <entry>Find the first occurrence of a string in the input</entry> + <entry>Find the first occurrence of a string in the input<sbr/>
+                        查找一个 string 在输入中的第一次出现</entry>
                         <entry>
                             <functionname>find_first()</functionname>
                             <sbr/>
@@ -191,7 +203,8 @@
                     </row>
                     <row>
                         <entry>find_last</entry>
- <entry>Find the last occurrence of a string in the input</entry> + <entry>Find the last occurrence of a string in the input<sbr/>
+                        查找一个 string 在输入中的最后一次出现</entry>
                         <entry>
                             <functionname>find_last()</functionname>
                             <sbr/>
@@ -200,7 +213,8 @@
                     </row>
                     <row>
                         <entry>find_nth</entry>
- <entry>Find the nth (zero-indexed) occurrence of a string in the input</entry> + <entry>Find the nth (zero-indexed) occurrence of a string in the input<sbr/> + 查找一个 string 在输入中的第 n 次(从 0 开始索引 )出现</entry>
                         <entry>
                             <functionname>find_nth()</functionname>
                             <sbr/>
@@ -209,35 +223,40 @@
                     </row>
                     <row>
                         <entry>find_head</entry>
-                        <entry>Retrieve the head of a string</entry>
+                        <entry>Retrieve the head of a string<sbr/>
+                        取回一个 string 的开头</entry>
                         <entry>
                             <functionname>find_head()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>find_tail</entry>
-                        <entry>Retrieve the tail of a string</entry>
+                        <entry>Retrieve the tail of a string<sbr/>
+                        取回一个 string 的末尾</entry>
                         <entry>
                             <functionname>find_tail()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>find_token</entry>
- <entry>Find first matching token in the string</entry> + <entry>Find first matching token in the string<sbr/>
+                        查找 string 中的第一个匹配标志</entry>
                         <entry>
                             <functionname>find_token()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>find_regex</entry>
- <entry>Use the regular expression to search the string</entry> + <entry>Use the regular expression to search the string<sbr/>
+                        使用正则表达式搜索 string</entry>
                         <entry>
                             <functionname>find_regex()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>find</entry>
-                        <entry>Generic find algorithm</entry>
+                        <entry>Generic find algorithm<sbr/>
+                        通用查找算法</entry>
                         <entry>
                             <functionname>find()</functionname>
                         </entry>
@@ -246,19 +265,20 @@
             </tgroup>
         </table>
         <table>
-            <title>Erase/Replace</title>
+            <title>Erase/Replace 删除/替换</title>
             <tgroup cols="3" align="left">
                 <thead>
                     <row>
-                        <entry>Algorithm name</entry>
-                        <entry>Description</entry>
-                        <entry>Functions</entry>
+                        <entry>Algorithm name 算法名称</entry>
+                        <entry>Description 说明</entry>
+                        <entry>Functions 函数</entry>
                     </row>
                 </thead>
                 <tbody>
                     <row>
                         <entry>replace/erase_first</entry>
- <entry>Replace/Erase the first occurrence of a string in the input</entry> + <entry>Replace/Erase the first occurrence of a string in the input<sbr/>
+                        替换/删除一个 string 在输入中的第一次出现</entry>
                         <entry>
                             <functionname>replace_first()</functionname>
                             <sbr/>
@@ -279,7 +299,8 @@
                     </row>
                     <row>
                         <entry>replace/erase_last</entry>
- <entry>Replace/Erase the last occurrence of a string in the input</entry> + <entry>Replace/Erase the last occurrence of a string in the input<sbr/>
+                        替换/删除一个 string 在输入中的最后一次出现</entry>
                         <entry>
                             <functionname>replace_last()</functionname>
                             <sbr/>
@@ -300,7 +321,8 @@
                     </row>
                     <row>
                         <entry>replace/erase_nth</entry>
- <entry>Replace/Erase the nth (zero-indexed) occurrence of a string in the input</entry> + <entry>Replace/Erase the nth (zero-indexed) occurrence of a string in the input<sbr/> + 替换/删除一个 string 在输入中的第 n 次(从 0 开始索 引)出现</entry>
                         <entry>
                             <functionname>replace_nth()</functionname>
                             <sbr/>
@@ -321,7 +343,8 @@
                     </row>
                     <row>
                         <entry>replace/erase_all</entry>
- <entry>Replace/Erase the all occurrences of a string in the input</entry> + <entry>Replace/Erase the all occurrences of a string in the input<sbr/>
+                        替换/删除一个 string 在输入中的所有出现</entry>
                         <entry>
                             <functionname>replace_all()</functionname>
                             <sbr/>
@@ -342,7 +365,8 @@
                     </row>
                     <row>
                         <entry>replace/erase_head</entry>
-                        <entry>Replace/Erase the head of the input</entry>
+                        <entry>Replace/Erase the head of the input<sbr/>
+                        替换/删除输入的开头</entry>
                         <entry>
                             <functionname>replace_head()</functionname>
                             <sbr/>
@@ -356,7 +380,8 @@
                     </row>
                     <row>
                         <entry>replace/erase_tail</entry>
-                        <entry>Replace/Erase the tail of the input</entry>
+                        <entry>Replace/Erase the tail of the input<sbr/>
+                        替换/删除输入的末尾</entry>
                         <entry>
                             <functionname>replace_tail()</functionname>
                             <sbr/>
@@ -370,7 +395,8 @@
                     </row>
                     <row>
                         <entry>replace/erase_regex</entry>
- <entry>Replace/Erase a substring matching the given regular expression</entry> + <entry>Replace/Erase a substring matching the given regular expression<sbr/> + 替换/删除与给定正则表达式匹配的一个 substring</entry>
                         <entry>
                             <functionname>replace_regex()</functionname>
                             <sbr/>
@@ -384,7 +410,8 @@
                     </row>
                     <row>
                         <entry>replace/erase_regex_all</entry>
- <entry>Replace/Erase all substrings matching the given regular expression</entry> + <entry>Replace/Erase all substrings matching the given regular expression<sbr/> + 替换/删除与给定正则表达式匹配的全部 substring</entry>
                         <entry>
<functionname>replace_all_regex()</functionname>
                             <sbr/>
@@ -398,7 +425,8 @@
                     </row>
                     <row>
                         <entry>find_format</entry>
-                        <entry>Generic replace algorithm</entry>
+                        <entry>Generic replace algorithm<sbr/>
+                        通用替换算法</entry>
                         <entry>
                             <functionname>find_format()</functionname>
                             <sbr/>
@@ -413,19 +441,20 @@
             </tgroup>
         </table>
         <table>
-            <title>Split</title>
+            <title>Split 分割</title>
             <tgroup cols="3" align="left">
                 <thead>
                     <row>
-                        <entry>Algorithm name</entry>
-                        <entry>Description</entry>
-                        <entry>Functions</entry>
+                        <entry>Algorithm name 算法名称</entry>
+                        <entry>Description 说明</entry>
+                        <entry>Functions 函数</entry>
                     </row>
                 </thead>
                 <tbody>
                     <row>
                         <entry>find_all</entry>
- <entry>Find/Extract all matching substrings in the input</entry> + <entry>Find/Extract all matching substrings in the input<sbr/>
+                        查找/选取输入中的所有匹配的 substring</entry>
                         <entry>
                             <functionname>find_all()</functionname>
                             <sbr/>
@@ -436,7 +465,8 @@
                     </row>
                     <row>
                         <entry>split</entry>
-                        <entry>Split input into parts</entry>
+                        <entry>Split input into parts<sbr/>
+                        将输入分给为若干部分</entry>
                         <entry>
                             <functionname>split()</functionname>
                             <sbr/>
@@ -445,14 +475,16 @@
                                        </row>
                                        <row>
                                                <entry>iter_find</entry>
- <entry>Iteratively apply the finder to the input to find all matching substrings</entry> + <entry>Iteratively apply the finder to the input to find all matching substrings<sbr/> + 在输入中迭代使用 Finder,以找到所有匹配的 substrings</entry>
                                                <entry>
                                                        
<functionname>iter_find()</functionname>
                                                </entry>
                                        </row>
                                        <row>
                                                <entry>iter_split</entry>
- <entry>Use the finder to find matching substrings in the input and use them as separators to split the input into parts</entry> + <entry>Use the finder to find matching substrings in the input and use them as separators to split the input into parts<sbr/> + 使用 Finder 在输入中查找匹配的 substrings,并将它们 作为分隔符将输入分割为若干部分</entry>
                                                <entry>
                                                        
<functionname>iter_split()</functionname>
                                                </entry>
@@ -461,26 +493,28 @@
             </tgroup>
         </table>
         <table>
-            <title>Join</title>
+            <title>Join 结合</title>
             <tgroup cols="3" align="left">
                 <thead>
                     <row>
-                        <entry>Algorithm name</entry>
-                        <entry>Description</entry>
-                        <entry>Functions</entry>
+                        <entry>Algorithm name 算法名称</entry>
+                        <entry>Description 说明</entry>
+                        <entry>Functions 函数</entry>
                     </row>
                 </thead>
                 <tbody>
                     <row>
                         <entry>join</entry>
- <entry>Join all elements in a container into a single string</entry> + <entry>Join all elements in a container into a single string<sbr/> + 将一个容器中的所有元素结合到一个单独的 string 中 </entry>
                         <entry>
                             <functionname>join</functionname>
                         </entry>
                     </row>
                         <row>
                         <entry>join_if</entry>
- <entry>Join all elements in a container that satisfies the condition into a single string</entry> + <entry>Join all elements in a container that satisfies the condition into a single string<sbr/> + 将一个容器中的所有满足条件的元素结合到一个单独的 string 中</entry>
                         <entry>
                             <functionname>join_if()</functionname>
                         </entry>
@@ -490,71 +524,79 @@
         </table>
     </section>
     <section>
-        <title>Finders and Formatters</title>
+        <title>Finders and Formatters 查找器与格式化器</title>

         <table>
-            <title>Finders</title>
+            <title>Finders 查找器</title>
             <tgroup cols="3" align="left">
                 <thead>
                     <row>
-                        <entry>Finder</entry>
-                        <entry>Description</entry>
-                        <entry>Generators</entry>
+                        <entry>Finder 查找器</entry>
+                        <entry>Description 说明</entry>
+                        <entry>Generators 生成器</entry>
                     </row>
                 </thead>
                 <tbody>
                     <row>
                         <entry>first_finder</entry>
- <entry>Search for the first match of the string in an input</entry> + <entry>Search for the first match of the string in an input<sbr/>
+                        在输入中搜索 string 的第一个匹配项</entry>
                         <entry>
                             <functionname>first_finder()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>last_finder</entry>
- <entry>Search for the last match of the string in an input</entry> + <entry>Search for the last match of the string in an input<sbr/>
+                        在输入中搜索 string 的最后一个匹配项</entry>
                         <entry>
                             <functionname>last_finder()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>nth_finder</entry>
- <entry>Search for the nth (zero-indexed) match of the string in an input</entry> + <entry>Search for the nth (zero-indexed) match of the string in an input<sbr/> + 在输入中搜索 string 的第 n 个(从 0 开始索引)匹配 项</entry>
                         <entry>
                             <functionname>nth_finder()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>head_finder</entry>
-                        <entry>Retrieve the head of an input</entry>
+                        <entry>Retrieve the head of an input<sbr/>
+                        取回输入的开头</entry>
                         <entry>
                             <functionname>head_finder()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>tail_finder</entry>
-                        <entry>Retrieve the tail of an input</entry>
+                        <entry>Retrieve the tail of an input<sbr/>
+                        取回输入的末尾</entry>
                         <entry>
                             <functionname>tail_finder()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>token_finder</entry>
- <entry>Search for a matching token in an input</entry> + <entry>Search for a matching token in an input<sbr/>
+                        在输入中搜索匹配的标志</entry>
                         <entry>
                             <functionname>token_finder()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>range_finder</entry>
- <entry>Do no search, always returns the given range</entry> + <entry>Do no search, always returns the given range<sbr/>
+                        不搜索,总是返回给定的 range</entry>
                         <entry>
                             <functionname>range_finder()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>regex_finder</entry>
- <entry>Search for a substring matching the given regex</entry> + <entry>Search for a substring matching the given regex<sbr/>
+                        搜索与给定 regex 匹配的一个 substring</entry>
                         <entry>
                             <functionname>regex_finder()</functionname>
                         </entry>
@@ -564,40 +606,44 @@
         </table>

         <table>
-            <title>Formatters</title>
+            <title>Formatters 格式化器</title>
             <tgroup cols="3" align="left">
                 <thead>
                     <row>
-                        <entry>Formatter</entry>
-                        <entry>Description</entry>
-                        <entry>Generators</entry>
+                        <entry>Formatter 格式化器</entry>
+                        <entry>Description 说明</entry>
+                        <entry>Generators 生成器</entry>
                     </row>
                 </thead>
                 <tbody>
                     <row>
                         <entry>const_formatter</entry>
- <entry>Constant formatter. Always return the specified string</entry> + <entry>Constant formatter. Always return the specified string<sbr/>
+                        常量 Formatter。总是返回特定的 string</entry>
                         <entry>
                             <functionname>const_formatter()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>identity_formatter</entry>
- <entry>Identity formatter. Return unmodified input input</entry> + <entry>Identity formatter. Return unmodified input input<sbr/>
+                        恒等 Formatter。返回没有改变的输入</entry>
                         <entry>
<functionname>identity_formatter()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>empty_formatter</entry>
- <entry>Null formatter. Always return an empty string</entry> + <entry>Null formatter. Always return an empty string<sbr/>
+                        空 Formatter。总是返回一个空 string</entry>
                         <entry>
                             <functionname>empty_formatter()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>regex_formatter</entry>
- <entry>Regex formatter. Format regex match using the specification in the format string</entry> + <entry>Regex formatter. Format regex match using the specification in the format string<sbr/> + Regex Formatter。使用格式化 string 中的规范格式化 regex 匹配项</entry>
                         <entry>
                             <functionname>regex_formatter()</functionname>
                         </entry>
@@ -607,29 +653,31 @@
         </table>
     </section>
     <section>
-        <title>Iterators</title>
+        <title>Iterators 迭代器</title>

         <table>
-            <title>Find Iterators</title>
+            <title>Find Iterators 查找迭代器</title>
             <tgroup cols="3" align="left">
                 <thead>
                     <row>
-                        <entry>Iterator name</entry>
-                        <entry>Description</entry>
-                        <entry>Iterator class</entry>
+                        <entry>Iterator name 迭代器名称</entry>
+                        <entry>Description 说明</entry>
+                        <entry>Iterator class 迭代器类</entry>
                     </row>
                 </thead>
                 <tbody>
                     <row>
                         <entry>find_iterator</entry>
- <entry>Iterates through matching substrings in the input</entry> + <entry>Iterates through matching substrings in the input<sbr/>
+                        在输入中 迭代遍历匹配的 substrings</entry>
                         <entry>
                             <classname>find_iterator</classname>
                         </entry>
                     </row>
                     <row>
                         <entry>split_iterator</entry>
- <entry>Iterates through gaps between matching substrings in the input</entry> + <entry>Iterates through gaps between matching substrings in the input<sbr/> + 在输入中迭代遍历匹配的 substrings 之间的间隔 </entry>
                         <entry>
                             <classname>split_iterator</classname>
                         </entry>
@@ -640,99 +688,111 @@
     </section>

     <section>
-        <title>Classification</title>
+        <title>Classification 分类</title>

         <table>
-            <title>Predicates</title>
+            <title>Predicates 判断式</title>
             <tgroup cols="3" align="left">
                 <thead>
                     <row>
-                        <entry>Predicate name</entry>
-                        <entry>Description</entry>
-                        <entry>Generator</entry>
+                        <entry>Predicate name 判断式名称</entry>
+                        <entry>Description 说明</entry>
+                        <entry>Generator 生成器</entry>
                     </row>
                 </thead>
                 <tbody>
                     <row>
                         <entry>is_classified</entry>
- <entry>Generic <code>ctype</code> mask based classification</entry> + <entry>Generic <code>ctype</code> mask based classification<sbr/>
+                        基于分类的通用 <code>ctype</code> 掩码</entry>
                         <entry>
                             <functionname>is_classified()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>is_space</entry>
-                        <entry>Recognize spaces</entry>
+                        <entry>Recognize spaces<sbr/>
+                        识别空格</entry>
                         <entry>
                             <functionname>is_space()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>is_alnum</entry>
-                        <entry>Recognize alphanumeric characters</entry>
+                        <entry>Recognize alphanumeric characters<sbr/>
+                        识别字母和数字字符</entry>
                         <entry>
                             <functionname>is_alnum()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>is_alpha</entry>
-                        <entry>Recognize letters</entry>
+                        <entry>Recognize letters<sbr/>
+                        识别字母</entry>
                         <entry>
                             <functionname>is_alpha()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>is_cntrl</entry>
-                        <entry>Recognize control characters</entry>
+                        <entry>Recognize control characters<sbr/>
+                        识别控制字符</entry>
                         <entry>
                             <functionname>is_cntrl()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>is_digit</entry>
-                        <entry>Recognize decimal digits</entry>
+                        <entry>Recognize decimal digits<sbr/>
+                        识别十进制数字</entry>
                         <entry>
                             <functionname>is_digit()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>is_graph</entry>
-                        <entry>Recognize graphical characters</entry>
+                        <entry>Recognize graphical characters<sbr/>
+                        识别图形字符</entry>
                         <entry>
                             <functionname>is_graph()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>is_lower</entry>
-                        <entry>Recognize lower case characters</entry>
+                        <entry>Recognize lower case characters<sbr/>
+                        识别小写字符</entry>
                         <entry>
                             <functionname>is_lower()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>is_print</entry>
-                        <entry>Recognize printable characters</entry>
+                        <entry>Recognize printable characters<sbr/>
+                        识别可打印字符</entry>
                         <entry>
                             <functionname>is_print()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>is_punct</entry>
-                        <entry>Recognize punctuation characters</entry>
+                        <entry>Recognize punctuation characters<sbr/>
+                        识别标点符号字符</entry>
                         <entry>
                             <functionname>is_punct()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>is_upper</entry>
-                        <entry>Recognize uppercase characters</entry>
+                        <entry>Recognize uppercase characters<sbr/>
+                        识别大写字符</entry>
                         <entry>
                             <functionname>is_upper()</functionname>
                         </entry>
                     </row>
                     <row>
                         <entry>is_xdigit</entry>
-                        <entry>Recognize hexadecimal digits</entry>
+                        <entry>Recognize hexadecimal digits<sbr/>
+                        识别十六进制数字</entry>
                         <entry>
                             <functionname>is_xdigit()</functionname>
                         </entry>
=======================================
--- /trunk/libs/algorithm/string/doc/rationale.xml      Mon Dec 28 23:05:14 2009
+++ /trunk/libs/algorithm/string/doc/rationale.xml      Sun Feb  7 05:34:27 2010
@@ -8,25 +8,30 @@
 -->

<section id="string_algo.rationale" last-revision="$Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $">
-    <title>Rationale</title>
+    <title>Rationale 一些解释</title>

     <using-namespace name="boost"/>
     <using-namespace name="boost::algorithm"/>

    <section it="string_algo.locale">
-        <title>Locales</title>
+        <title>Locales 地区设置</title>

         <para>
Locales have a very close relation to string processing. They contain information about the character sets and are used, for example, to change the case of characters and
-            to classify the characters.
+            to classify the characters. <sbr/>
+ 地区设置和 string 处理有非常密切的关系。它们包括关于字符集的信 息,
+            还包括,比如说,字符的大小写转换和字符的分类等信息。
         </para>
         <para>
C++ allows to work with multiple different instances of locales at once. If an algorithm manipulates some data in a way that requires the usage of locales, there must be a way to specify them. However, one instance of locales is sufficient for most of the applications, and for a user it could be very tedious to specify which locales to use at every place
-            where it is needed.
+            where it is needed. <sbr/>
+ C++ 允许同时工作在多个不同的地区设置实例上。如果一个算法需要按 照地区习惯的方法来处理某些数据, + 就必须有一种指定它们的方法。然而,对与大多数应用程序来说一个地 区设置实例已经足够了, + 在每一需要的地方指定使用哪一个地区,对于用户来说,这是非常单调 乏味的。
         </para>
         <para>
Fortunately, the C++ standard allows to specify the <emphasis>global</emphasis> locales (using static member
@@ -35,18 +40,25 @@
be initialized with the <emphasis>global</emphasis> locale. This implies, that if an algorithm needs a locale, it should have an <code>std::locale</code> parameter defaulting to <code>std::locale()</code>. If a user needs to specify locales explicitly, she can do so. Otherwise the <emphasis>global</emphasis>
-            locales are used.
+            locales are used.<sbr/>
+ 幸运的时,C++ 标准允许指定 <emphasis>全局</emphasis> 地区设置 (使用静态成员函数 <code>std:locale::global()</code>)。 + 在不使用显式信息实例化一个 <code>std::locale</code> 类时,就使 用 <emphasis>全局</emphasis> 地区设置初始化这个实例。 + 这就意味着,如果一个算法需要地区设置,它就应该有一个缺省为 <code>std::locale()</code> 的参数。 + 如果一个用户需要显式指定地区设置时,她就可以这样做。否则,就使 用 <emphasis>全局</emphasis> 地区设置。
         </para>
     </section>
     <section id="string_algo.regex">
-        <title>Regular Expressions</title>
+        <title>Regular Expressions 正则表达式</title>

         <para>
Regular expressions are an essential part of text processing. For this reason, the library also provides regex variants of some algorithms. The library does not attempt to replace <libraryname>Boost.Regex</libraryname>; it merely wraps its functionality in a new interface. As a part of this library, regex algorithms integrate smoothly with other components, which
-            brings additional value.
+            brings additional value.<sbr/>
+ 正则表达式时文本处理的精髓部分。因此,本库也提供了某些算法的 regex 变体。本库并不打算取代 + <libraryname>Boost.Regex</libraryname>,它只不过将前者的功能外 面包装在一个新的接口中。 + 作为本库的一部分,regex 算法和其它组件无缝地结合在一起,产生了 额外的价值。
         </para>
     </section>
 </section>
=======================================
--- /trunk/libs/algorithm/string/doc/release_notes.xml Mon Dec 28 23:05:14 2009 +++ /trunk/libs/algorithm/string/doc/release_notes.xml Sun Feb 7 05:34:27 2010
@@ -12,16 +12,18 @@
     <using-namespace name="boost"/>
     <using-namespace name="boost::algorithm"/>

-    <title>Release Notes</title>
+    <title>Release Notes 发布注记</title>

     <itemizedlist>
         <listitem>
             <para><emphasis role="bold">1.32</emphasis></para>
-            <para>Initial release in Boost</para>
+            <para>Initial release in Boost<sbr/>
+            Boost 中的最初发布版</para>
         </listitem>
         <listitem>
             <para><emphasis role="bold">1.33</emphasis></para>
- <para>Internal version of collection traits removed, library adapted to Boost.Range</para> + <para>Internal version of collection traits removed, library adapted to Boost.Range<sbr/>
+            收集被移除特性的内部版本,库配合了 Boost.Range</para>
         </listitem>
         <listitem>
             <para><emphasis role="bold">1.34</emphasis></para>
@@ -33,11 +35,13 @@
<functionname>join()</functionname> and <functionname>join_if()</functionname>
                 </listitem>
                 <listitem>
- New comparison predicates <code>is_less</code>, <code>is_not_greater</code> + New comparison predicates <code>is_less</code>, <code>is_not_greater</code><sbr/> + 新的比较判断式 <code>is_less</code>, <code>is_not_greater</code>
                 </listitem>
                 <listitem>
Negative indexes support (like Perl) in various algorihtms
-                     (<code>*_head/tail</code>, <code>*_nth</code>).
+                     (<code>*_head/tail</code>, <code>*_nth</code>).<sbr/>
+ 在多个算法(<code>*_head/tail</code>, <code>*_nth</code>)中对负索引的支持(类似于 Perl)。
                 </listitem>
             </itemizedlist>
         </listitem>
=======================================
--- /trunk/libs/algorithm/string/doc/usage.xml  Mon Dec 28 23:05:14 2009
+++ /trunk/libs/algorithm/string/doc/usage.xml  Sun Feb  7 05:34:27 2010
@@ -10,17 +10,18 @@


<section id="string_algo.usage" last-revision="$Date: 2009-06-14 18:56:08 -0400 (Sun, 14 Jun 2009) $">
-    <title>Usage</title>
+    <title>Usage 用法</title>

     <using-namespace name="boost"/>
     <using-namespace name="boost::algorithm"/>


     <section>
-        <title>First Example</title>
+        <title>First Example 第一个例子</title>

         <para>
- Using the algorithms is straightforward. Let us have a look at the first example: + Using the algorithms is straightforward. Let us have a look at the first example:<sbr/>
+            使用这些算法简单易懂。我们来看看第一个例子:
         </para>
         <programlisting>
     #include &lt;boost/algorithm/string.hpp&gt;
@@ -41,7 +42,9 @@
         <para>
This example converts str1 to upper case and trims spaces from the start and the end of the string. str2 is then created as a copy of str1 with "hello" replaced with "goodbye". - This example demonstrates several important concepts used in the library: + This example demonstrates several important concepts used in the library:<sbr/> + 这个例子将 str1 转换为大写,并修剪 string 头尾的空格。然后,以 str1 的拷贝的方式创建 str2, + 并用 "goodbye" 替换 "hello"。这个例子示范了本库使用的几个重要概 念:
         </para>
         <itemizedlist>
             <listitem>
@@ -51,14 +54,22 @@
but it has several limitations. It is not possible to <emphasis>stack</emphasis> algorithms together, because a container is passed in two parameters. Therefore it is not possible to use a return value from another algorithm. It is considerably easier to write - <code>to_lower(str1)</code>, than <code>to_lower(str1.begin(), str1.end())</code>. + <code>to_lower(str1)</code>, than <code>to_lower(str1.begin(), str1.end())</code>.<sbr/> + <emphasis role="bold">容器参数:</emphasis>与 STL 算法 不同,参数并不一定要用迭代器的方式指定。 + STL 的惯例具有很大的灵活性,但也有几个限制。它不可能将 算法 <emphasis>套叠</emphasis>在一起, + 因为一个容器需要用两个参数传递。因此它就不可能使用另一 个算法的返回值。写成 <code>to_lower(str1)</code>, + 比 <code>to_lower(str1.begin(), str1.end())</code> 要简 单得多。
                 </para>
                 <para>
The magic of <ulink url="../../libs/range/index.html">Boost.Range</ulink> provides a uniform way of handling different string types.
                     If there is a need to pass a pair of iterators,
<ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink> - can be used to package iterators into a structure with a compatible interface. + can be used to package iterators into a structure with a compatible interface.<sbr/> + <ulink url="../../libs/range/index.html">Boost.Range</ulink> 的魔力提供了处理不同 string 类型的统一方法。
+                    如果需要传递一对迭代器,就可以用
+ <ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink>
+                    将迭代器打包到一个具有可兼容接口的结构中。
                 </para>
             </listitem>
             <listitem>
@@ -67,14 +78,20 @@
The transformation can be done in-place, mutating the input sequence, or a copy of the transformed input can be created, leaving the input intact. None of these possibilities is superior to the other one and both have different - advantages and disadvantages. For this reason, both are provided with the library. + advantages and disadvantages. For this reason, both are provided with the library. <sbr/> + <emphasis role="bold">拷贝 vs. 变化:</emphasis>本库很 多算法对输入执行某种转换。 + 这种转换可以在原地进行,改变输入序列,也可以创建一个转 换后的输入的拷贝,而保持原始输入不变。 + 这些可能性中并没有一种比另一种更加优越,而且各有利弊。 因此,本库同时提供了这两种方式。
                 </para>
             </listitem>
             <listitem>
                 <para><emphasis role="bold">Algorithm stacking:</emphasis>
Copy versions return a transformed input as a result, thus allow a simple chaining of transformations within one expression (i.e. one can write <code>trim_copy(to_upper_copy(s))</code>). - Mutable versions have <code>void</code> return, to avoid misuse. + Mutable versions have <code>void</code> return, to avoid misuse.<sbr/> + <emphasis role="bold">算法套叠:</emphasis>拷贝版本返回 一个转换后的输入作为结果, + 这样就允许将转换简单地串接在一个表达式中(例如,我们可 以这样写 <code>trim_copy(to_upper_copy(s))</code>)。
+                    可变版本返回 <code>void</code>,以避免误用。
                 </para>
             </listitem>
             <listitem>
@@ -84,22 +101,29 @@
and the copy version has the suffix <emphasis>_copy</emphasis>.
                     Some algorithms have the prefix <emphasis>i</emphasis>
                     (e.g. <functionname>ifind_first()</functionname>).
- This prefix identifies that the algorithm works in a case-insensitive manner. + This prefix identifies that the algorithm works in a case-insensitive manner.<sbr/> + <emphasis role="bold">命名:</emphasis>命名遵循来自于标 准 C++ 库的管理。 + 如果同一个算法有拷贝和可变两个版本,则可变版本没有后 缀,而拷贝版本有后缀 <emphasis>_copy</emphasis>。 + 有些算法有前缀 <emphasis>i</emphasis>(比如 <functionname>ifind_first()</functionname>)。
+                    这个前缀表明这个算法以大小写无关方式工作。
                 </para>
             </listitem>
         </itemizedlist>
         <para>
To use the library, include the <headername>boost/algorithm/string.hpp</headername> header.
             If the regex related functions are needed, include the
- <headername>boost/algorithm/string_regex.hpp</headername> header. + <headername>boost/algorithm/string_regex.hpp</headername> header.<sbr/> + 为使用本库,需要包含 <headername>boost/algorithm/string.hpp</headername> 头文件。 + 如果需要与 regex 相关的函数,则包含 <headername>boost/algorithm/string_regex.hpp</headername> 头文件。
         </para>
     </section>
     <section>
-        <title>Case conversion</title>
+        <title>Case conversion 大小写转换</title>

         <para>
STL has a nice way of converting character case. Unfortunately, it works only
-            for a single character and we want to convert a string,
+            for a single character and we want to convert a string, <sbr/>
+ STL 有一个转换字符大小写的不错的方法。不幸的是,它只对单个的字 符有效,而我们要转换一个 string,
         </para>
         <programlisting>
     string str1("HeLlO WoRld!");
@@ -107,16 +131,20 @@
         </programlisting>
         <para>
<functionname>to_upper()</functionname> and <functionname>to_lower()</functionname> convert the case of
-            characters in a string using a specified locale.
+            characters in a string using a specified locale.<sbr/>
+ <functionname>to_upper()</functionname> 和 <functionname>to_lower()</functionname> + 使用一个指定的地区设置转换一个 string 中的 characters 的大小 写。
         </para>
         <para>
- For more information see the reference for <headername>boost/algorithm/string/case_conv.hpp</headername>. + For more information see the reference for <headername>boost/algorithm/string/case_conv.hpp</headername>.<sbr/> + 关于更多的信息请参见 <headername>boost/algorithm/string/case_conv.hpp</headername> 的参考。
         </para>
     </section>
     <section>
-        <title>Predicates and Classification</title>
+        <title>Predicates and Classification 判断式与分类</title>
         <para>
- A part of the library deals with string related predicates. Consider this example: + A part of the library deals with string related predicates. Consider this example:<sbr/>
+            本库的一部分用于处理和 string 相关的判断式。考虑这个例子:
         </para>
         <programlisting>
     bool is_executable( string&amp; filename )
@@ -147,7 +175,10 @@
under various conditions. The conditions are: a string starts with the substring,
             ends with the substring,
simply contains the substring or if both strings are equal. See the reference for - <headername>boost/algorithm/string/predicate.hpp</headername> for more details. + <headername>boost/algorithm/string/predicate.hpp</headername> for more details. <sbr/> + 判断式用于判定在各种条件下,一个 substring 是否包含于输入 string。条件为: + 一个 string 以这个 substring 开始,以这个 substring 结尾,直接 包含这个 substring 以及两个 string 是否相等。 + 更多的细节请参见 <headername>boost/algorithm/string/predicate.hpp</headername> 的参考。
         </para>
         <para>
In addition the algorithm <functionname>all()</functionname> checks
@@ -156,15 +187,20 @@
             useful string-related predicates and combinators ready for use.
These are located in the <headername>boost/algorithm/string/classification.hpp</headername> header. Classification predicates can be combined using logical combinators to form - a more complex expressions. For example: <code>is_from_range('a','z') || is_digit()</code> + a more complex expressions. For example: <code>is_from_range('a','z') || is_digit()</code><sbr/> + 另外,算法 <functionname>all()</functionname> 检查一个容器中的 所有元素是否满足由一个判断式指定的条件。 + 这个判断式可以是任何一元判断式,但是本库提供了一系列有用的 string 相关的判断式和连接符备用。 + 它们位于 <headername>boost/algorithm/string/classification.hpp</headername> 头文件。 + 分类判断式可以用逻辑连接符连接起来形成一个更复杂的表达式。例 如:<code>is_from_range('a','z') || is_digit()</code>。
         </para>
     </section>
     <section>
-        <title>Trimming</title>
+        <title>Trimming 修剪</title>

         <para>
When parsing the input from a user, strings usually have unwanted leading or trailing
-            characters. To get rid of them, we need trim functions:
+            characters. To get rid of them, we need trim functions:<sbr/>
+ 在解析来自用户的输入时,strings 中通常会有不需要的开头或拖尾字 符。为了去掉它们,我们需要修剪函数:
         </para>
         <programlisting>
     string str1="     hello world!     ";
@@ -182,14 +218,19 @@
are <emphasis>_if</emphasis> variants. Using these, a user can specify a functor which will select the <emphasis>space</emphasis> to be removed. It is possible to use classification predicates like <functionname>is_digit()</functionname> mentioned in the previous paragraph. - See the reference for the <headername>boost/algorithm/string/trim.hpp</headername>. + See the reference for the <headername>boost/algorithm/string/trim.hpp</headername>.<sbr/> + 它可以修剪一个 string 右边的,左边的或两边的空格。而且,为了应 付移除某些空格以外的东西的需要, + 有一个 <emphasis>_if</emphasis> 变量,用户可以指定一个仿函数用 来选择要被移除的 <emphasis>space</emphasis>。 + 它可能使用我们前面提到过的类似 <functionname>is_digit()</functionname> 这样的分类判断式。 + 请参见 <headername>boost/algorithm/string/trim.hpp</headername> 的参考。
         </para>
     </section>
     <section>
-        <title>Find algorithms</title>
+        <title>Find algorithms 查找算法</title>

         <para>
- The library contains a set of find algorithms. Here is an example: + The library contains a set of find algorithms. Here is an example:<sbr/>
+            本库包含一套查找算法。如下例:
         </para>
         <programlisting>
     char text[]="hello dolly!";
@@ -219,18 +260,30 @@
             The following lines transform the result. Notice that
<ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink> has familiar <code>begin()</code> and <code>end()</code> methods, so it can be used like any other STL container. - Also it is convertible to bool therefore it is easy to use find algorithms for a simple containment checking. + Also it is convertible to bool therefore it is easy to use find algorithms for a simple containment checking.<sbr/> + 我们使用 <functionname>find_last()</functionname> 在 <code>text</code> 中查找 "ll"。 + 结果以 <ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink> 的形式给出。 + 这个范围限定了输入中符合查找规则的部分。在我们的例子中就是最后 一次出现的 "ll"。就像我们看到的, + <functionname>find_last()</functionname> 算法的输入也可以是 char[], + 因为这个类型也被 <ulink url="../../libs/range/index.html">Boost.Range</ulink> 所支持。
+            接下来的代码行转换这个结果。注意
+ <ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink> 具有通常的 + <code>begin()</code> 和 <code>end()</code> 方法,所以它可以像任 何其它 STL 容器一样使用。 + 它也可以转换为 bool,因此它可以很容易地使用查找算法做一个简单的 包含检查。
         </para>
         <para>
- Find algorithms are located in <headername>boost/algorithm/string/find.hpp</headername>. + Find algorithms are located in <headername>boost/algorithm/string/find.hpp</headername>.<sbr/> + 查找算法位于 <headername>boost/algorithm/string/find.hpp</headername> 中。
         </para>
     </section>
     <section>
-        <title>Replace Algorithms</title>
+        <title>Replace Algorithms 替换算法</title>
         <para>
Find algorithms can be used for searching for a specific part of string. Replace goes one step further. After a matching part is found, it is substituted with something else. The substitution is computed
-            from the original, using some transformation.
+            from the original, using some transformation. <sbr/>
+ 查找算法可以用于搜索 string 的一个指定部分。替换则又向前走了一 步。在找到一个匹配部分后, + 用其它东西来取代它。取代的部分根据原始文本计算,并使用了某些转 换。
         </para>
         <programlisting>
     string str1="Hello  Dolly,   Hello World!"
@@ -249,15 +302,25 @@
a <link linkend="string_algo.formatter_concept">Formatter</link> object. The Finder object is a functor which performs the searching for the replacement part. The Formatter object takes the result of the Finder (usually a reference to the found substring) and creates a - substitute for it. Replace algorithm puts these two together and makes the desired substitution. + substitute for it. Replace algorithm puts these two together and makes the desired substitution. <sbr/> + 关于替换和删除函数的完整列表,请参见 <link linkend="string_algo.reference">参考</link>。 + 有很多预定义的函数用于通常用法,本库还允许你定义一个定制化的 <code>replace()</code> 来适应一个指定的要求。 + 有一个通用的持有两个参数的 <functionname>find_format()</functionname> 函数。第一个参数是一个 + <link linkend="string_algo.finder_concept">Finder</link> 对 象,第二个参数是一个 + <link linkend="string_algo.formatter_concept">Formatter</link> 对象。 + Finder 对象是一个用于执行搜索替换部分的仿函数。Formatter 对象持 有 Finder 的结果 + (通常是对所找到的子串的一个引用)并为它创建一个取代。替换算法 将两者结合起来得到想要的取代。
         </para>
         <para>
Check <headername>boost/algorithm/string/replace.hpp</headername>, <headername>boost/algorithm/string/erase.hpp</headername> and - <headername>boost/algorithm/string/find_format.hpp</headername> for reference. + <headername>boost/algorithm/string/find_format.hpp</headername> for reference.<sbr/> + 参见 <headername>boost/algorithm/string/replace.hpp</headername>,
+            <headername>boost/algorithm/string/erase.hpp</headername> 和
+ <headername>boost/algorithm/string/find_format.hpp</headername> 中的参考。
         </para>
     </section>
     <section>
-        <title>Find Iterator</title>
+        <title>Find Iterator 查找迭代器</title>

         <para>
An extension to find algorithms it the Find Iterator. Instead of searching for just a one part of a string,
@@ -265,12 +328,19 @@
This facility is using the <link linkend="string_algo.finder_concept">Finder</link> to incrementally
             search the string.
Dereferencing a find iterator yields an <ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink>
-            object, that delimits the current match.
+            object, that delimits the current match.<sbr/>
+ 查找迭代器是对查找算法的一种扩展。不仅仅是找到一个 string 的一 个部分。 + 查找迭代器允许我们迭代遍历匹配指定规则的全部 substring。这个部 件使用 + <link linkend="string_algo.finder_concept">Finder</link> 来增量 式地搜索 string。解引用一个查找迭代器产生一个 + <ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink> 对象,
+            它限定了当前的匹配范围。
         </para>
         <para>
There are two iterators provided <classname>find_iterator</classname> and <classname>split_iterator</classname>. The former iterates over substrings that are found using the specified - Finder. The latter iterates over the gaps between these substrings. + Finder. The latter iterates over the gaps between these substrings.<sbr/> + 有两个提供的迭代器是 <classname>find_iterator</classname> 和 <classname>split_iterator</classname>。 + 前者迭代遍历用指定 Finder 找到的全部 substrings。后者迭代遍历这 些 substraings 之间的间隔。
         </para>
         <programlisting>
     string str1("abc-*-ABC-*-aBc");
@@ -308,24 +378,33 @@
Note that the find iterators have only one template parameter. It is the base iterator type. The Finder is specified at runtime. This allows us to typedef a find iterator for common string types and reuse it. Additionally make_*_iterator functions help
-            to construct a find iterator for a particular range.
+            to construct a find iterator for a particular range.<sbr/>
+ 注意查找迭代器只有一个模板参数。它是基本的迭代器类型。Finder 在 运行时指定。
+            这允许我们为通常的 string 类型 typedef 一个查找迭代器并复用它。
+ 另外 make_*_iterator 函数帮助我们为某个特定的范围创建一个查找迭 代器。
         </para>
         <para>
- See the reference in <headername>boost/algorithm/string/find_iterator.hpp</headername>. + See the reference in <headername>boost/algorithm/string/find_iterator.hpp</headername>.<sbr/> + 请参见 <headername>boost/algorithm/string/find_iterator.hpp</headername> 中的参考。
         </para>
     </section>
     <section>
-        <title>Split</title>
+        <title>Split 分割</title>

         <para>
Split algorithms are an extension to the find iterator for one common usage scenario. These algorithms use a find iterator and store all matches into the provided container. This container must be able to hold copies (e.g. <code>std::string</code>) or - references (e.g. <code>iterator_range</code>) of the extracted substrings. + references (e.g. <code>iterator_range</code>) of the extracted substrings.<sbr/> + 分割算法是查找迭代器为一种常用的使用方案所做的扩展。这些算法使 用一个查找迭代器并将全部匹配项存储在提供的容器中。 + 这个容器必须能够持有被选取的 substrings 的拷贝(比如 <code>std::string</code>)或引用
+            (比如 <code>iterator_range</code>)。
         </para>
         <para>
Two algorithms are provided. <functionname>find_all()</functionname> finds all copies - of a string in the input. <functionname>split()</functionname> splits the input into parts. + of a string in the input. <functionname>split()</functionname> splits the input into parts.<sbr/> + 提供了两个算法。<functionname>find_all()</functionname> 在输入 中查找一个 string 的所有拷贝。
+            <functionname>split()</functionname> 将输入分割为若干个部分。
         </para>

         <programlisting>
@@ -342,20 +421,26 @@
split( SplitVec, str1, is_any_of("-*") ); // SplitVec == { "hello abc","ABC","aBc goodbye" }
         </programlisting>
         <para>
- <code>[hello]</code> designates an <code>iterator_range</code> delimiting this substring. + <code>[hello]</code> designates an <code>iterator_range</code> delimiting this substring. <sbr/> + <code>[hello]</code> 表示一个限定这个子串的 <code>iterator_range</code>。
         </para>
         <para>
First example show how to construct a container to hold references to all extracted substrings. Algorithm <functionname>ifind_all()</functionname> puts into FindVec references - to all substrings that are in case-insensitive manner equal to "abc". + to all substrings that are in case-insensitive manner equal to "abc".<sbr/> + 第一个例子展示如何创建一个持有全部被选取的子串的容器。算法 <functionname>ifind_all()</functionname> + 将全部以大小写无关方式等于 "abc" 的 substring 的引用放入 FindVec 中。
         </para>
         <para>
Second example uses <functionname>split()</functionname> to split string str1 into parts separated by characters '-' or '*'. These parts are then put into the SplitVec. - It is possible to specify if adjacent separators are concatenated or not. + It is possible to specify if adjacent separators are concatenated or not.<sbr/> + 第二个例子使用 <functionname>split()</functionname> 将 string str1 分割成以字符 '-' 或 '*' 分隔的若干个部分。 + 然后将这些部分放入 SplitVec 中。它还可以指定是否将相邻的分隔符 连接在一起。
         </para>
         <para>
- More information can be found in the reference: <headername>boost/algorithm/string/split.hpp</headername>. + More information can be found in the reference: <headername>boost/algorithm/string/split.hpp</headername>.<sbr/> + 更多信息可以在参考 <headername>boost/algorithm/string/split.hpp</headername> 中找到。
         </para>
    </section>
 </section>
=======================================
--- /trunk/libs/static_assert/doc/static_assert.qbk     Mon Dec 28 23:05:14 2009
+++ /trunk/libs/static_assert/doc/static_assert.qbk     Sun Feb  7 05:34:27 2010
@@ -17,9 +17,10 @@

 This manual is also available in
[@http://svn.boost.org/svn/boost/sandbox/pdf/static_assert/release/static_assert.pdf
-printer friendly PDF format].
-
-[section:intro Overview and Tutorial]
+printer friendly PDF format].\n
+本手册还提供了 [@http://svn.boost.org/svn/boost/sandbox/pdf/static_assert/release/static_assert.pdf 适于打印的PDF格式]。
+
+[section:intro Overview and Tutorial 综述及指南]

The header `<boost/static_assert.hpp>` supplies a single macro `BOOST_STATIC_ASSERT(x)`, which generates a compile time error message if the integral-constant-expression `x`
@@ -29,27 +30,37 @@
 then the macro will generate neither code nor data - and the macro can also
be used at either namespace, class or function scope. When used in a template, the static assertion will be evaluated at the time the template is instantiated;
-this is particularly useful for validating template parameters.
+this is particularly useful for validating template parameters. \n
+头文件 `<boost/static_assert.hpp>` 提供了一个独立的宏 `BOOST_STATIC_ASSERT(x)`,如果 integral-constant-expression `x` 不为 true, +将产生一个编译时错误信息。换句话说,它是一个 assert 宏在编译时的等价物,这 有时被称为“编译时断言”,但在当前这些文档中被称为“静态断言”。 +注意,如果条件为 true,这个宏将不生成代码和数据――而这个宏既可以用于名字空间 域,类域,也可以用于函数域。
+当用在模板中时,静态断言在模板实例化时被评估,这在确定模板参数时特别有用。

One of the aims of `BOOST_STATIC_ASSERT` is to generate readable error messages. These immediately tell the user that a library is being used in a manner that is not supported. While error messages obviously differ from compiler to compiler,
-but you should see something like:
+but you should see something like: \n
+`BOOST_STATIC_ASSERT` 的目标之一是生成可读的错误信息。这些就立刻告诉使用者 一个库的某种用法是不被支持的。 +这时的错误信息针对不同的编译器会有明显的不同,但你应该会看到类似这样的东 西:

    Illegal use of STATIC_ASSERTION_FAILURE<false>

-Which is intended to at least catch the eye!
+Which is intended to at least catch the eye!\n
+这样至少能让人抓住要害!

You can use `BOOST_STATIC_ASSERT` at any place where you can place a declaration,
 that is at class, function or namespace scope, this is illustrated by the
-following examples:
-
-[section:namespace Use at namespace scope.]
+following examples:\n
+你可以在任何能够放置一个声明的地方使用 `BOOST_STATIC_ASSERT`,也就是说在类 域,函数与或名字空间域中,以下是举例说明:
+
+[section:namespace Use at namespace scope. 在名字空间域中使用]

 The macro can be used at namespace scope, if there is some requirement must
 always be true; generally this means some platform specific requirement.
Suppose we require that `int` be at least a 32-bit integral type, and that `wchar_t`
-be an unsigned type. We can verify this at compile time as follows:
+be an unsigned type. We can verify this at compile time as follows:\n
+如果在名字空间域中有一些条件必须总为 true(这通常意味着平台的特殊需求),那 么就可以把这个宏用在名字空间域中。 +假设我们需要 `int` 至少是一个 32-bit 的整类型,而且 `wchar_t` 必须是一个 unsigned 类型。我们可以在编译时进行这样的校验:

    #include <climits>
    #include <cwchar>
@@ -76,11 +87,18 @@
typedef declarations, however many do not do so (and even if they do they are entitled to emit warnings in such cases). To avoid potential problems, if you
 use `BOOST_STATIC_ASSERT` in a header and at namespace scope, then enclose
-them in a namespace unique to that header.
+them in a namespace unique to that header.\n
+这里名字空间 my_conditions 的用法需要一些解释。宏 `BOOST_STATIC_ASSERT` 一 般是通过一个 typedef 声明在起作用, +而且因为 typedef 必须有一个名字,宏通过自动从 `__LINE__` 的值中截取一个片段 来生成一个名字。 +当在类域或函数域中使用 `BOOST_STATIC_ASSERT` 时,每一个使用 `BOOST_STATIC_ASSERT` 的地方保证生成一个在域中唯一的名字 +(只要你在每一行中最多只使用一次宏)。但是如果用在一个头文件的名字空间域 中,而这个名字空间会在多个头文件中延续, +每一个都可以有它自己的静态断言,因此在“相同”的行,就会生成重复的声明。在理 论上编译器应该默默地忽略重复的 typedef 声明, +但是很多编译器并没有这样做(即使它们这样做了,它们也有资格在这种情况下发出 一个警告)。为了避免潜在的问题, +如果你在一个头文件而且是在名字空间中使用 `BOOST_STATIC_ASSERT`,那么将它们 封装在一个在头文件中是唯一的名字空间中。

 [endsect]

-[section:function Use at function scope]
+[section:function Use at function scope 在函数域中使用]

 The macro is typically used at function scope inside template functions,
 when the template arguments need checking. Imagine that we have an
@@ -91,7 +109,12 @@
 determine what went wrong. One option is to add a static assertion at
 the top level of the template, in that case if the condition is not met,
then an error will be generated in a way that makes it reasonably obvious to
-the user that the template is being misused.
+the user that the template is being misused.\n
+这个宏在函数域中的典型用法就是用在模板函数内部,用来检查模板参数。设想我们 有一个基于迭代器的算法需要随机访问迭代器。 +如果这个算法被一个迭代器实例化,而这个迭代器不符合我们的要求,那么最终就会 产生一个错误, +但是这可能深深地嵌套在几层模板之内,让使用者去确定到底哪里发生了问题可能很 困难。
+一种选择就是在模板的最上层增加一个静态断言,这样一来,如果条件没有被满足,
+那么错误会以一种对于误用模板的使用者来说相当明显的方式产生出来。

    #include <iterator>
    #include <boost/static_assert.hpp>
@@ -120,16 +143,21 @@
 for `is_convertible` is a reference type, as some compilers have problems
using `is_convertible` when the conversion is via a user defined constructor
 (in any case there is no guarantee that the iterator tag classes are
-copy-constructible).
+copy-constructible).\n
+有几个脚注记录在此:那一对围绕断言的额外插入的圆括号,是为了防止 `is_convertible` 模板内部的逗号被预处理器解释成为宏参数的分隔符; +`is_convertible` 的目标类型是一个引用类型,因为如果转换需要使用一个用户定义 构造函数的话, +某些编译器在使用 `is_convertible` 时会出问题(在某些情况下,不能保证这里的 iterator tag 类是可拷贝构造的)。

 [endsect]

-[section:class Use at class scope]
+[section:class Use at class scope 在类域中使用]

 The macro is typically used inside classes that are templates.
Suppose we have a template-class that requires an unsigned integral type with
 at least 16-bits of precision as a template argument, we can achieve this
-using something like this:
+using something like this:\n
+这个宏经常会用在那些是模板的类中。假设我们有一个模板类需要一个精度至少为 16-bit 的无符号整类型作为一个模板参数,
+我们可以像这样做到这一点:

    #include <limits>
    #include <boost/static_assert.hpp>
@@ -148,14 +176,17 @@

 [endsect]

-[section:templates Use in templates]
+[section:templates Use in templates 在模板中使用]

 Normally static assertions when used inside a class or function template,
will not be instantiated until the template in which it is used is instantiated. However, there is one potential problem to watch out for: if the static assertion
 is not dependent upon one or more template parameters, then the compiler is
 permitted to evaluate the static assertion at the point it is first seen,
-irrespective of whether the template is ever instantiated, for example:
+irrespective of whether the template is ever instantiated, for example:\n
+通常情况下,用在一个类模板或函数模板中静态断言不会被实例化,直到那个使用它 的模板被实例化, +它才会被实例化。可是,这里就要提防一个问题:如果静态断言没有依赖于一个或更 多的模板参数, +那么编译器就被准许在它第一次看到静态断言的时候就评估它,而不管模板是否已经 被实例化,例如:

    template <class T>
    struct must_not_be_instantiated
@@ -166,7 +197,9 @@
 Will produce a compiler error with some compilers (for example Intel 8.1
 or gcc 3.4), regardless of whether the template is ever instantiated.  A
 workaround in cases like this is to force the assertion to be dependent
-upon a template parameter:
+upon a template parameter:\n
+无论模板是否已经被实例化,这在某些编译器(例如 Intel 8.1 或 gcc 3.4)上,都 会产生一个编译错误。
+在这种情况下,就要强迫这个断言依赖于一个模板参数:

    template <class T>
    struct must_not_be_instantiated
@@ -180,10 +213,11 @@

 [endsect]

-[section:how How it works]
+[section:how How it works 如何工作]

`BOOST_STATIC_ASSERT` works as follows. There is class `STATIC_ASSERTION_FAILURE`
- which is defined as:
+ which is defined as:\n
+`BOOST_STATIC_ASSERT` 像下面这样工作。有一个类 `STATIC_ASSERTION_FAILURE` 是这样定义的:

    namespace boost{

@@ -200,28 +234,32 @@
 The use of a macro here is somewhat ugly; however boost members have spent
 considerable effort trying to invent a static assert that avoided macros,
all to no avail. The general conclusion was that the good of a static assert -working at namespace, function, and class scope outweighed the ugliness of a macro. +working at namespace, function, and class scope outweighed the ugliness of a macro.\n +关键的特性是错误信息由未定义表达式 `sizeof(STATIC_ASSERTION_FAILURE<0>)` 来 触发,这样可以兼容于大多数编译器。 +`BOOST_STATIC_ASSERT` 体系内的其它东西仅仅是将 `sizeof` 表达式注入一个 `typedef` 的方法。 +在这里用一个宏多少有点难堪,无论如何,boost 成员用尽了值得考虑的努力试图创 造一种可以避免宏的静态断言方法,但一无所成。 +大致的结论是在名字空间域,函数域和类域中工作的一个静态断言的好处超过了一个 宏的丑陋。

 [endsect]

-[section:test Test Programs]
-
-[table Test programs provided with static_assert
-[[Test Program][Expected to Compile][Description]]
-
-[[[@../../libs/static_assert/static_assert_test.cpp static_assert_test.cpp]] [Yes] [Illustrates usage, and should always compile, really just tests compiler compatibility.]] -[[[@../../libs/static_assert/static_assert_example_1.cpp static_assert_example_1.cpp]] [Platform dependent.] [Namespace scope test program, may compile depending upon the platform. ]] -[[[@../../libs/static_assert/static_assert_example_2.cpp static_assert_example_2.cpp]] [Yes] [Function scope test program. ]] -[[[@../../libs/static_assert/static_assert_example_3.cpp static_assert_example_3.cpp]] [Yes] [Class scope test program. ]] -[[[@../../libs/static_assert/static_assert_test_fail_1.cpp static_assert_test_fail_1.cpp]] [No] [Illustrates failure at namespace scope. ]] -[[[@../../libs/static_assert/static_assert_test_fail_2.cpp static_assert_test_fail_2.cpp]] [No] [Illustrates failure at non-template function scope. ]] -[[[@../../libs/static_assert/static_assert_test_fail_3.cpp static_assert_test_fail_3.cpp]] [No] [Illustrates failure at non-template class scope. ]] -[[[@../../libs/static_assert/static_assert_test_fail_4.cpp static_assert_test_fail_4.cpp]] [No] [Illustrates failure at non-template class scope. ]] -[[[@../../libs/static_assert/static_assert_test_fail_5.cpp static_assert_test_fail_5.cpp]] [No] [Illustrates failure at template class scope. ]] -[[[@../../libs/static_assert/static_assert_test_fail_6.cpp static_assert_test_fail_6.cpp]] [No] [Illustrates failure at template class member function scope. ]] -[[[@../../libs/static_assert/static_assert_test_fail_7.cpp static_assert_test_fail_7.cpp]] [No] [Illustrates failure of class scope example. ]] -[[[@../../libs/static_assert/static_assert_test_fail_8.cpp static_assert_test_fail_8.cpp]] [No] [Illustrates failure of function scope example. ]] -[[[@../../libs/static_assert/static_assert_test_fail_9.cpp static_assert_test_fail_9.cpp]] [No] [Illustrates failure of function scope example (part 2). ]]
+[section:test Test Programs 测试程序]
+
+[table Test programs provided with static_assert 随static_assert一起提供的 测试程序
+[[Test Program 测试程序][Expected to Compile 编译预期][Description 描述]]
+
+[[[@../../libs/static_assert/static_assert_test.cpp static_assert_test.cpp]] [Yes] [Illustrates usage, and should always compile, really just tests compiler compatibility.\n说明用法,而且应该总是可 以编译,实际上正好可以测试编译器的兼容性。]] +[[[@../../libs/static_assert/static_assert_example_1.cpp static_assert_example_1.cpp]] [Platform dependent.\n平台相关] [Namespace scope test program, may compile depending upon the platform. \n名字空间域测 试程序,编译时可能与平台相关。]] +[[[@../../libs/static_assert/static_assert_example_2.cpp static_assert_example_2.cpp]] [Yes] [Function scope test program. \n函数域测 试程序。]] +[[[@../../libs/static_assert/static_assert_example_3.cpp static_assert_example_3.cpp]] [Yes] [Class scope test program. \n类域测试程 序。]] +[[[@../../libs/static_assert/static_assert_test_fail_1.cpp static_assert_test_fail_1.cpp]] [No] [Illustrates failure at namespace scope. \n说明在名字空间域的失败。]] +[[[@../../libs/static_assert/static_assert_test_fail_2.cpp static_assert_test_fail_2.cpp]] [No] [Illustrates failure at non-template function scope. \n说明在非模板函数域的失败。]] +[[[@../../libs/static_assert/static_assert_test_fail_3.cpp static_assert_test_fail_3.cpp]] [No] [Illustrates failure at non-template class scope. \n说明在非模板类域的失败。]] +[[[@../../libs/static_assert/static_assert_test_fail_4.cpp static_assert_test_fail_4.cpp]] [No] [Illustrates failure at non-template class scope. \n说明在非模板类域的失败。]] +[[[@../../libs/static_assert/static_assert_test_fail_5.cpp static_assert_test_fail_5.cpp]] [No] [Illustrates failure at template class scope. \n说明在模板类域的失败。]] +[[[@../../libs/static_assert/static_assert_test_fail_6.cpp static_assert_test_fail_6.cpp]] [No] [Illustrates failure at template class member function scope. \n说明在模板类成员函数域的失败。]] +[[[@../../libs/static_assert/static_assert_test_fail_7.cpp static_assert_test_fail_7.cpp]] [No] [Illustrates failure of class scope example. \n说明在类域的失败示例。]] +[[[@../../libs/static_assert/static_assert_test_fail_8.cpp static_assert_test_fail_8.cpp]] [No] [Illustrates failure of function scope example. \n说明在函数域的失败示例。]] +[[[@../../libs/static_assert/static_assert_test_fail_9.cpp static_assert_test_fail_9.cpp]] [No] [Illustrates failure of function scope example (part 2). \n说明在函数域的失败示例(第 2 部分)。]]

 ]

=======================================
--- /trunk/libs/thread/doc/acknowledgements.qbk Mon Dec 28 23:05:14 2009
+++ /trunk/libs/thread/doc/acknowledgements.qbk Sun Feb  7 05:34:27 2010
@@ -5,7 +5,7 @@
   http://www.boost.org/LICENSE_1_0.txt).
 ]

-[section:acknowledgements Acknowledgments]
+[section:acknowledgements Acknowledgments 鸣谢]

The original implementation of __boost_thread__ was written by William Kempf, with contributions from numerous others. This new version initially grew out of an attempt to rewrite __boost_thread__ to William Kempf's design with fresh code that could be
=======================================
--- /trunk/libs/thread/doc/barrier.qbk  Mon Dec 28 23:05:14 2009
+++ /trunk/libs/thread/doc/barrier.qbk  Sun Feb  7 05:34:27 2010
@@ -5,11 +5,13 @@
   http://www.boost.org/LICENSE_1_0.txt).
 ]

-[section:barriers Barriers]
+[section:barriers Barriers 栏栅]

A barrier is a simple concept. Also known as a ['rendezvous], it is a synchronization point between multiple threads. The barrier is configured for a particular number of threads (`n`), and as threads reach the barrier they must wait until all `n` threads have -arrived. Once the `n`-th thread has reached the barrier, all the waiting threads can proceed, and the barrier is reset. +arrived. Once the `n`-th thread has reached the barrier, all the waiting threads can proceed, and the barrier is reset.\n +"栏栅"是一个简单的概念。也被称为 ['会合], 是多个线程间的同步点。栏栅被配置 为一定数量的线程使用(`n`),当线程到达栏栅时,他们必须等待, +直到所有 `n` 个线程都到达这个栏栅。当第 `n` 个线程到达栏栅,所有的线程才能 继续执行,并且这个栏栅对象被复位。

 [section:barrier Class `barrier`]

@@ -24,31 +26,37 @@
         bool wait();
     };

-Instances of __barrier__ are not copyable or movable.
-
-[heading Constructor]
+Instances of __barrier__ are not copyable or movable.\n
+__barrier__ 对象不支持拷贝和转移。
+
+[heading Constructor 构造函数]

     barrier(unsigned int count);

 [variablelist

-[[Effects:] [Construct a barrier for `count` threads.]]
-
-[[Throws:] [__thread_resource_error__ if an error occurs.]]
+[[Effects:] [Construct a barrier for `count` threads.\n
+构造一个支持 `count` 个线程的栏栅。]]
+
+[[Throws:] [__thread_resource_error__ if an error occurs.\n
+如果出错,抛出 __thread_resource_error__ 异常。]]

 ]

-[heading Destructor]
+[heading Destructor 析构函数]

     ~barrier();

 [variablelist

-[[Precondition:] [No threads are waiting on `*this`.]]
-
-[[Effects:] [Destroys `*this`.]]
-
-[[Throws:] [Nothing.]]
+[[Precondition:] [No threads are waiting on `*this`.\n
+没有线程在等待 `*this`。]]
+
+[[Effects:] [Destroys `*this`.\n
+销毁 `*this`。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -59,11 +67,14 @@
 [variablelist

[[Effects:] [Block until `count` threads have called `wait` on `*this`. When the `count`-th thread calls `wait`, all waiting threads
-are unblocked, and the barrier is reset. ]]
-
-[[Returns:] [`true` for exactly one thread from each batch of waiting threads, `false` otherwise.]]
-
-[[Throws:] [__thread_resource_error__ if an error occurs.]]
+are unblocked, and the barrier is reset. \n
+阻塞当前线程直到 `count` 个线程对 `*this` 调用 `wait`, 当第 `count` 个线程 调用 `wait`,所有阻塞的线程解除阻塞,栏栅被复位。]]
+
+[[Returns:] [`true` for exactly one thread from each batch of waiting threads, `false` otherwise.\n
+如果每批等待线程中正好有一个线程,返回 `true`,否则返回 `false`。]]
+
+[[Throws:] [__thread_resource_error__ if an error occurs.\n
+如果出错,抛出 __thread_resource_error__ 异常。]]

 ]

=======================================
--- /trunk/libs/thread/doc/changes.qbk  Mon Dec 28 23:05:14 2009
+++ /trunk/libs/thread/doc/changes.qbk  Sun Feb  7 05:34:27 2010
@@ -7,81 +7,117 @@

 [section:changes Changes since boost 1.40]

-The 1.41.0 release of Boost adds futures to the thread library. There are also a few minor changes. +The 1.41.0 release of Boost adds futures to the thread library. There are also a few minor changes.\n
+Boost的1.41.0版本为 thread 库增加了 futures。另外还有一些不太重要的修改。

 [heading Changes since boost 1.35]

-The 1.36.0 release of Boost includes a few new features in the thread library:
-
-* New generic __lock_multiple_ref__ and __try_lock_multiple_ref__ functions for locking multiple mutexes at once.
-
-* Rvalue reference support for move semantics where the compilers supports it.
-
-* A few bugs fixed and missing functions added (including the serious win32 condition variable bug).
-
-* `scoped_try_lock` types are now backwards-compatible with Boost 1.34.0 and previous releases.
-
-* Support for passing function arguments to the thread function by supplying additional arguments to the __thread__ constructor.
-
-* Backwards-compatibility overloads added for `timed_lock` and `timed_wait` functions to allow use of `xtime` for timeouts. +The 1.36.0 release of Boost includes a few new features in the thread library:\n
+1.36.0 版包含了以下新特性:
+
+* New generic __lock_multiple_ref__ and __try_lock_multiple_ref__ functions for locking multiple mutexes at once.\n + 新的通用锁定函数 __lock_multiple_ref__ 和__try_lock_multiple_ref__, 可以 一次锁定多个互斥量。
+
+* Rvalue reference support for move semantics where the compilers supports it.\n
+  编译器支持的条件下,支持转移语义中的右值引用。
+
+* A few bugs fixed and missing functions added (including the serious win32 condition variable bug).\n + 修复了一些问题,补上了一些缺失的函数(包括 win32 平台上状态变量的严重 bug)。
+
+* `scoped_try_lock` types are now backwards-compatible with Boost 1.34.0 and previous releases.\n
+  `scoped_try_lock` 类型兼容于 Boost 1.34.0 和更早的版本。
+
+* Support for passing function arguments to the thread function by supplying additional arguments to the __thread__ constructor.\n
+  支持通过 __thread__ 构造函数的额外参数传递函数参数给线程函数。
+
+* Backwards-compatibility overloads added for `timed_lock` and `timed_wait` functions to allow use of `xtime` for timeouts.\n
+  重载 `timed_lock` 和 `timed_wait` 函数支持使用 `xtime` 做超时类型。

 [heading Changes since boost 1.34]

Almost every line of code in __boost_thread__ has been changed since the 1.34 release of boost. However, most of the interface changes have been extensions, so the new code is largely backwards-compatible with the old code. The new features and breaking
-changes are described below.
-
-[heading New Features]
-
-* Instances of __thread__ and of the various lock types are now movable.
-
-* Threads can be interrupted at __interruption_points__.
+changes are described below.\n
+__boost_thread__ 库差不多的所有代码和1.34版相比都被改写了。然而,大多数接口 变化被扩展,使这些新的代码也能兼容就的代码。
+新特性和明显的变化列举如下:
+
+[heading New Features 新特性]
+
+* Instances of __thread__ and of the various lock types are now movable.\n
+  __thread__ 和锁类型支持转移语义。
+
+* Threads can be interrupted at __interruption_points__.\n
+  线程可在 __interruption_points__ 被中断。

* Condition variables can now be used with any type that implements the __lockable_concept__, through the use of `boost::condition_variable_any` (`boost::condition` is a `typedef` to `boost::condition_variable_any`, provided for backwards compatibility). `boost::condition_variable` is provided as an optimization, and will only work with
-`boost::unique_lock<boost::mutex>` (`boost::mutex::scoped_lock`).
+`boost::unique_lock<boost::mutex>` (`boost::mutex::scoped_lock`).\n
+通过使用 `boost::condition_variable_any`,条件变量现在可以和任意实现了 __lockable_concept__ 的类型一起工作。 +(`boost::condition` 是 `boost::condition_variable_any` 的一个 `typedef`,提 供后向兼容性), +`boost::condition_variable` 作为一个优化提供,并且只能和 `boost::unique_lock<boost::mutex>` (`boost::mutex::scoped_lock`)一起工作。

* Thread IDs are separated from __thread__, so a thread can obtain it's own ID (using `boost::this_thread::get_id()`), and IDs can -be used as keys in associative containers, as they have the full set of comparison operators. +be used as keys in associative containers, as they have the full set of comparison operators.\n +线程标识从 __thread__ 类中分离出来, 这样一个线程可以获得自己的对应的标识(使 用 `boost::this_thread::get_id()`), 并且线程标识可以被用作关联容器的键,因 为它们有完全的比较操作符。

* Timeouts are now implemented using the Boost DateTime library, through a typedef `boost::system_time` for absolute timeouts, and -with support for relative timeouts in many cases. `boost::xtime` is supported for backwards compatibility only. +with support for relative timeouts in many cases. `boost::xtime` is supported for backwards compatibility only.\n +通过 Boost DateTime library实现了超时,采用 `boost::system_time` 作为绝对时 间,在很多场合支持相对的时间段超时,
+`boost::xtime` 只是为了兼容性和被支持。

* Locks are implemented as publicly accessible templates `boost::lock_guard`, `boost::unique_lock`, `boost::shared_lock`, and `boost::upgrade_lock`, which are templated on the type of the mutex. The __lockable_concept__ has been extended to include publicly -available __lock_ref__ and __unlock_ref__ member functions, which are used by the lock types.
-
-[heading Breaking Changes]
-
-The list below should cover all changes to the public interface which break backwards compatibility. +available __lock_ref__ and __unlock_ref__ member functions, which are used by the lock types.\n +锁定通过一些公开的模板实现,如 `boost::lock_guard`, `boost::unique_lock`, `boost::shared_lock`,和 `boost::upgrade_lock`, 具体实现取决于作为模板参数 的互斥量。__lockable_concept__ 被扩展,增加供锁定操作需要使用的 __lock_ref__ 和 __unlock_ref__ 成员函数。
+
+[heading Breaking Changes 破坏性变化]
+
+The list below should cover all changes to the public interface which break backwards compatibility.\n
+下面列出没有保持兼容的接口改变:

* __try_mutex__ has been removed, and the functionality subsumed into __mutex__. __try_mutex__ is left as a `typedef`,
-but is no longer a separate class.
+but is no longer a separate class.\n
+__try_mutex__ 被移除了, 它的功能被包含在 __mutex__。__try_mutex__ 只是作为 一个 `typedef` 存在,而不是单独的类。

* __recursive_try_mutex__ has been removed, and the functionality subsumed into -__recursive_mutex__. __recursive_try_mutex__ is left as a `typedef`, but is no longer a separate class. +__recursive_mutex__. __recursive_try_mutex__ is left as a `typedef`, but is no longer a separate class.\n +__recursive_try_mutex__ 被移除了,其功能被包含在 __recursive_mutex__. __recursive_try_mutex__ 只是作为一个 `typedef` 存在,
+而不是单独的类。

* `boost::detail::thread::lock_ops` has been removed. Code that relies on the `lock_ops` implementation detail will no longer work, as this has been removed, as it is no longer necessary now that mutex types now have public __lock_ref__ and __unlock_ref__ member
-functions.
-
-* `scoped_lock` constructors with a second parameter of type `bool` are no longer provided. With previous boost releases,
+functions.\n
+`boost::detail::thread::lock_ops` 被移除了,依赖于 `lock_ops` 实现的代码将 不能工作。`lock_ops` 已经不再需要,
+因为互斥量现在已经有公用的 __lock_ref__ 和 __unlock_ref__ 函数。
+
+* `scoped_lock` constructors with a second parameter of type `bool` are no longer provided. With previous boost releases,\n + `scoped_lock` 中支持第二个 `bool` 参数的构造函数被移除了。在以前的 boost 版本,如下的定义 ``boost::mutex::scoped_lock some_lock(some_mutex,false);`` could be used to create a lock object that was associated with a mutex, but did not lock it on construction. This facility has now been replaced with the constructor that takes a -`boost::defer_lock_type` as the second parameter: ``boost::mutex::scoped_lock some_lock(some_mutex,boost::defer_lock);``
-
-* The `locked()` member function of the `scoped_lock` types has been renamed to __owns_lock_ref__.
+`boost::defer_lock_type` as the second parameter: \n
+可以用来创建一个和互斥量关联的锁对象,但是并不马上在构造是锁定它。这个功能 现在被以 `boost::defer_lock_type`
+作为第二个参数的构造函数代替了:
+``boost::mutex::scoped_lock some_lock(some_mutex,boost::defer_lock);``
+
+* The `locked()` member function of the `scoped_lock` types has been renamed to __owns_lock_ref__.\n
+  `scoped_lock` 类型的成员函数 `locked()` 改名为 __owns_lock_ref__。

* You can no longer obtain a __thread__ instance representing the current thread: a default-constructed __thread__ object is not associated with any thread. The only use for such a thread object was to support the comparison operators: this functionality has
-been moved to __thread_id__.
-
-* The broken `boost::read_write_mutex` has been replaced with __shared_mutex__.
-
-* __mutex__ is now never recursive. For Boost releases prior to 1.35 __mutex__ was recursive on Windows and not on POSIX platforms.
+been moved to __thread_id__.\n
+不能在当前线程内获得代表自己的 __thread__ 对象,现在一个默认构造出来的 __thread__ 实例不会关联到任何线程, +这样的实例唯一的用处是在线程做比较时。现在这些功能(标识线程)都被移到 __thread_id__ 类型里了。
+
+* The broken `boost::read_write_mutex` has been replaced with __shared_mutex__.\n
+  `boost::read_write_mutex` 被 __shared_mutex__ 取代了。
+
+* __mutex__ is now never recursive. For Boost releases prior to 1.35 __mutex__ was recursive on Windows and not on POSIX platforms.\n + __mutex__ 现在不是支持递归的,在1.35版以前,__mutex__ 在 Windows平台上是 支持递归的,而在POSIX 平台上却不是。

* When using a __recursive_mutex__ with a call to [cond_any_wait_link `boost::condition_variable_any::wait()`], the mutex is only - unlocked one level, and not completely. This prior behaviour was not guaranteed and did not feature in the tests. + unlocked one level, and not completely. This prior behaviour was not guaranteed and did not feature in the tests.\n + 当 __recursive_mutex__ 配合 [cond_any_wait_link `boost::condition_variable_any::wait()`] 使用时,该函数只是释放一次锁定,
+  而不是所有的锁定。这个在以前是不被保证的,也没有体现在测试代码中。

 [endsect]
=======================================
--- /trunk/libs/thread/doc/condition_variables.qbk      Mon Dec 28 23:05:14 2009
+++ /trunk/libs/thread/doc/condition_variables.qbk      Sun Feb  7 05:34:27 2010
@@ -5,9 +5,9 @@
   http://www.boost.org/LICENSE_1_0.txt).
 ]

-[section:condvar_ref Condition Variables]
-
-[heading Synopsis]
+[section:condvar_ref Condition Variables 条件变量]
+
+[heading:synopsis Synopsis 概述]

 The classes `condition_variable` and `condition_variable_any` provide a
mechanism for one thread to wait for notification from another thread that a
@@ -17,7 +17,11 @@
the wait, then it checks to see if the appropriate condition is now true, and continues if so. If the condition is not true, then the thread then calls `wait` again to resume waiting. In the simplest case, this condition is just a boolean
-variable:
+variable:\n
+类型 `condition_variable` 和 `condition_variable_any` 提供一个种机制,一个 线程可以等待另外一个线程内某个事件发生的通知。 +通常的应用模式是一个线程锁定一个互斥量,然后通过函数 `wait` 等待一个 `condition_variable` 或 `condition_variable_any` 实例, +当线程从等待中被唤醒激活时,检查特定的条件是否满足,如果满足,线程继续执 行。如果不满足,线程则再次调用 `wait` 以继续等待。
+最简单的情况下,这个条件只是一个布尔变量。

     boost::condition_variable cond;
     boost::mutex mut;
@@ -40,11 +44,14 @@
mutex. When the thread is woken, the mutex will be locked again before the call to `wait` returns. This allows other threads to acquire the mutex in order to update the shared data, and ensures that the data associated with the condition
-is correctly synchronized.
+is correctly synchronized.\n
+请注意 `lock` 对象会传递给 `wait` 函数: `wait` 函数会自动将线程添加到等待条 件变量的线程集合中,并且解锁传递进来的互斥量。 +当线程被唤醒,`wait` 退出前互斥量会再次被锁定。这样允许其他线程获取互斥量来 更新共享的数据,确保条件变量关联的数据被正确同步。

In the mean time, another thread sets the condition to `true`, and then calls
 either `notify_one` or `notify_all` on the condition variable to wake one
-waiting thread or all the waiting threads respectively.
+waiting thread or all the waiting threads respectively.\n
+同时,另外的线程将这个条件置为 `true`,然后对条件变量调用函数 `notify_one` 或 `notify_all` 来唤醒等待该条件变量的一个或多个线程。

     void retrieve_data();
     void prepare_data();
@@ -61,7 +68,8 @@
     }

Note that the same mutex is locked before the shared data is updated, but that
-the mutex does not have to be locked across the call to `notify_one`.
+the mutex does not have to be locked across the call to `notify_one`.\n
+注意,同一个互斥量在共享数据被更新前被锁定,但是这个互斥量锁定范围不需要包 含函数 `notify_one` 调用。

This example uses an object of type `condition_variable`, but would work just as well with an object of type `condition_variable_any`: `condition_variable_any`
@@ -70,7 +78,10 @@
`boost::unique_lock<boost::mutex>`. This enables `condition_variable` to make
 optimizations in some cases, based on the knowledge of the mutex type;
 `condition_variable_any` typically has a more complex implementation than
-`condition_variable`.
+`condition_variable`.\n
+这个例子使用一个 `condition_variable` 对象,如果换成 `condition_variable_any` 对象也是同样适用:`condition_variable_any` 更加通 用, +支持和其他类型的互斥量和锁定类型,而 `condition_variable` 要求传递给函数 `wait` 的是 `boost::unique_lock<boost::mutex>` 对象。 +这样在已知互斥量的条件下,`condition_variable` 可以做适当的优 化;`condition_variable_any` 类型的实现比 `condition_variable` 复杂许多。

 [section:condition_variable Class `condition_variable`]

@@ -116,9 +127,11 @@

 [variablelist

-[[Effects:] [Constructs an object of class `condition_variable`.]]
-
-[[Throws:] [__thread_resource_error__ if an error occurs.]]
+[[Effects:] [Constructs an object of class `condition_variable`.\n
+创建一个 `condition_variable` 对象。]]
+
+[[Throws:] [__thread_resource_error__ if an error occurs.\n
+如果出现错误,抛出异常 __thread_resource_error__。]]

 ]

@@ -130,11 +143,15 @@

[[Precondition:] [All threads waiting on `*this` have been notified by a call to
 `notify_one` or `notify_all` (though the respective calls to `wait` or
-`timed_wait` need not have returned).]]
-
-[[Effects:] [Destroys the object.]]
-
-[[Throws:] [Nothing.]]
+`timed_wait` need not have returned).\n
+所有等待 `*this` 的线程得到通知通过调用函数 `notify_one` 或 `notify_all`
+(尽管不是每个独立的函数调用 `wait` 或 `timed_wait` 都返回)。]]
+
+[[Effects:] [Destroys the object.\n
+销毁条件变量。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -145,9 +162,11 @@
 [variablelist

[[Effects:] [If any threads are currently __blocked__ waiting on `*this` in a call
-to `wait` or `timed_wait`, unblocks one of those threads.]]
-
-[[Throws:] [Nothing.]]
+to `wait` or `timed_wait`, unblocks one of those threads.\n
+如果有线程当前因为等待 `*this` 而在 `wait` 或 `timed_wait` 中 __blocked__,这个函数调用会解除一个线程的阻塞状态。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -158,9 +177,11 @@
 [variablelist

[[Effects:] [If any threads are currently __blocked__ waiting on `*this` in a call
-to `wait` or `timed_wait`, unblocks all of those threads.]]
-
-[[Throws:] [Nothing.]]
+to `wait` or `timed_wait`, unblocks all of those threads.\n
+如果有线程当前因为等待 `*this` 而在 `wait` 或 `timed_wait` 中 __blocked__,这个函数调用会解除所有这些线程的阻塞状态。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -174,20 +195,27 @@
thread is currently waiting on `*this`, or the execution of the `mutex()` member function on the `lock` objects supplied in the calls to `wait` or `timed_wait` in all the threads currently waiting on `*this` would return the same value as
-`lock->mutex()` for this call to `wait`.]]
+`lock->mutex()` for this call to `wait`.\n
+`lock` 对象被当前线程锁定, 并且要么没有其它线程正在等待 `*this`,要么在所有 当前正在等待 `*this` 的线程中调用 `wait` 或 `timed_wait` 所给定的 `lock` 对 象执行 `mutex()` 成员函数, 返回与本 `wait` 调用中的 `lock->mutex()` 相同的 值。]]

[[Effects:] [Atomically call `lock.unlock()` and blocks the current thread. The
 thread will unblock when notified by a call to `this->notify_one()` or
`this->notify_all()`, or spuriously. When the thread is unblocked (for whatever reason), the lock is reacquired by invoking `lock.lock()` before the call to `wait` returns. The lock is also reacquired by invoking `lock.lock()` if the
-function exits with an exception.]]
-
-[[Postcondition:] [`lock` is locked by the current thread.]]
+function exits with an exception.\n
+自动调用 `lock.unlock()` 并且阻塞当前线程。线程在 `this->notify_one()` 或 `this->notify_all()` 调用通知后解除阻塞状态。 +当线程被解除阻塞(不论任何原因)时,在 `wait` 函数退出前调用 `lock.lock()` 来 加锁。
+如果这个函数因为异常退出,退出前也会调用 `lock.lock()`。]]
+
+[[Postcondition:] [`lock` is locked by the current thread.\n
+当前线程锁定 `lock`。]]

 [[Throws:] [__thread_resource_error__ if an error
 occurs. __thread_interrupted__ if the wait was interrupted by a call to
-__interrupt__ on the __thread__ object associated with the current thread of execution.]] +__interrupt__ on the __thread__ object associated with the current thread of execution.\n +如果出错则抛出异常 __thread_resource_error__。如果对线程执行体关联的 __thread__ 对象调用 __interrupt__,
+抛出 __thread_interrupted__ 异常。]]

 ]

@@ -197,7 +225,8 @@

 [variablelist

-[[Effects:] [As-if ``
+[[Effects:] [As-if\n
+相当于 ``
 while(!pred())
 {
     wait(lock);
@@ -216,7 +245,8 @@
thread is currently waiting on `*this`, or the execution of the `mutex()` member function on the `lock` objects supplied in the calls to `wait` or `timed_wait` in all the threads currently waiting on `*this` would return the same value as
-`lock->mutex()` for this call to `wait`.]]
+`lock->mutex()` for this call to `wait`.\n
+`lock` 对象被当前线程锁定, 并且要么没有其它线程正在等待 `*this`,要么在所有 当前正在等待 `*this` 的线程中调用 `wait` 或 `timed_wait` 所给定的 `lock` 对 象执行 `mutex()` 成员函数, 返回与本 `wait` 调用中的 `lock->mutex()` 相同的 值。]]

[[Effects:] [Atomically call `lock.unlock()` and blocks the current thread. The
 thread will unblock when notified by a call to `this->notify_one()` or
@@ -224,16 +254,24 @@
would be equal to or later than the specified `abs_time`, or spuriously. When
 the thread is unblocked (for whatever reason), the lock is reacquired by
 invoking `lock.lock()` before the call to `wait` returns. The lock is also
-reacquired by invoking `lock.lock()` if the function exits with an exception.]] +reacquired by invoking `lock.lock()` if the function exits with an exception.\n +自动调用 `lock.unlock()` 并且阻塞当前线程。线程在 `this->notify_one()` 或 `this->notify_all()` 调用通知后, +或当 `boost::get_system_time()` 所报告的时间等于或后于给定的 `abs_time` 时 解除阻塞状态。 +当线程被解除阻塞(不论任何原因)时,在 `wait` 函数退出前调用 `lock.lock()` 来 加锁。
+如果这个函数因为异常退出,退出前也会调用 `lock.lock()`。]]

 [[Returns:] [`false` if the call is returning because the time specified by
-`abs_time` was reached, `true` otherwise.]]
-
-[[Postcondition:] [`lock` is locked by the current thread.]]
+`abs_time` was reached, `true` otherwise.\n
+如果函数因为 `abs_time` 到达而退出,返回 `false`,否则 `true`。]]
+
+[[Postcondition:] [`lock` is locked by the current thread.\n
+当前线程锁定 `lock`。]]

 [[Throws:] [__thread_resource_error__ if an error
 occurs. __thread_interrupted__ if the wait was interrupted by a call to
-__interrupt__ on the __thread__ object associated with the current thread of execution.]] +__interrupt__ on the __thread__ object associated with the current thread of execution.\n +如果出错则抛出异常 __thread_resource_error__。如果对线程执行体关联的 __thread__ 对象调用 __interrupt__,
+抛出 __thread_interrupted__ 异常。]]

 ]

@@ -247,7 +285,8 @@
thread is currently waiting on `*this`, or the execution of the `mutex()` member function on the `lock` objects supplied in the calls to `wait` or `timed_wait` in all the threads currently waiting on `*this` would return the same value as
-`lock->mutex()` for this call to `wait`.]]
+`lock->mutex()` for this call to `wait`.\n
+`lock` 对象被当前线程锁定, 并且要么没有其它线程正在等待 `*this`,要么在所有 当前正在等待 `*this` 的线程中调用 `wait` 或 `timed_wait` 所给定的 `lock` 对 象执行 `mutex()` 成员函数, 返回与本 `wait` 调用中的 `lock->mutex()` 相同的 值。]]

[[Effects:] [Atomically call `lock.unlock()` and blocks the current thread. The
 thread will unblock when notified by a call to `this->notify_one()` or
@@ -255,20 +294,28 @@
argument has elapsed, or spuriously. When the thread is unblocked (for whatever reason), the lock is reacquired by invoking `lock.lock()` before the call to `wait` returns. The lock is also reacquired by invoking `lock.lock()` if the
-function exits with an exception.]]
+function exits with an exception.\n
+自动调用 `lock.unlock()` 并且阻塞当前线程。线程在 `this->notify_one()` 或 `this->notify_all()` 调用通知后, +或当 `rel_time` 所表示的时间已过去时解除阻塞状态。当线程被解除阻塞(不论任何 原因)时,在 `wait` 函数退出前调用 `lock.lock()` 来加锁。
+如果这个函数因为异常退出,退出前也会调用 `lock.lock()`。]]

[[Returns:] [`false` if the call is returning because the time period specified
-by `rel_time` has elapsed, `true` otherwise.]]
-
-[[Postcondition:] [`lock` is locked by the current thread.]]
+by `rel_time` has elapsed, `true` otherwise.\n
+如果函数因为 `rel_time` 过去而退出,返回 `false`,否则 `true`。]]
+
+[[Postcondition:] [`lock` is locked by the current thread.\n
+当前线程锁定 `lock`。]]

 [[Throws:] [__thread_resource_error__ if an error
 occurs. __thread_interrupted__ if the wait was interrupted by a call to
-__interrupt__ on the __thread__ object associated with the current thread of execution.]] +__interrupt__ on the __thread__ object associated with the current thread of execution.\n +如果出错则抛出异常 __thread_resource_error__。如果对线程执行体关联的 __thread__ 对象调用 __interrupt__,
+抛出 __thread_interrupted__ 异常。]]

 ]

-[note The duration overload of timed_wait is difficult to use correctly. The overload taking a predicate should be preferred in most cases.] +[note The duration overload of timed_wait is difficult to use correctly. The overload taking a predicate should be preferred in most cases.\n +使用时间段参数的 timed_wait 函数难以正确使用,通常情况下带断言的重载比较容 易使用。]

 [endsect]

@@ -276,7 +323,8 @@

 [variablelist

-[[Effects:] [As-if ``
+[[Effects:] [As-if \n
+相当于 ``
 while(!pred())
 {
     if(!timed_wait(lock,abs_time))
@@ -341,9 +389,11 @@

 [variablelist

-[[Effects:] [Constructs an object of class `condition_variable_any`.]]
-
-[[Throws:] [__thread_resource_error__ if an error occurs.]]
+[[Effects:] [Constructs an object of class `condition_variable_any`.\n
+创建一个 `condition_variable_any` 对象。]]
+
+[[Throws:] [__thread_resource_error__ if an error occurs.\n
+如果出错则抛出 __thread_resource_error__ 异常。]]

 ]

@@ -355,11 +405,15 @@

[[Precondition:] [All threads waiting on `*this` have been notified by a call to
 `notify_one` or `notify_all` (though the respective calls to `wait` or
-`timed_wait` need not have returned).]]
-
-[[Effects:] [Destroys the object.]]
-
-[[Throws:] [Nothing.]]
+`timed_wait` need not have returned).\n
+所有等待 `*this` 的线程得到通知,通过调用函数 `notify_one` 或 `notify_all`,
+(尽管不是每个独立的函数调用 `wait` 或 `timed_wait` 都返回)。]]
+
+[[Effects:] [Destroys the object.\n
+销毁这个对象。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -370,9 +424,11 @@
 [variablelist

[[Effects:] [If any threads are currently __blocked__ waiting on `*this` in a call
-to `wait` or `timed_wait`, unblocks one of those threads.]]
-
-[[Throws:] [Nothing.]]
+to `wait` or `timed_wait`, unblocks one of those threads.\n
+如果有线程当前因在 `wait` 或 `timed_wait` 中等待 `*this` 而 __blocked__,这 个函数调用会解除一个线程的阻塞状态。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -383,9 +439,11 @@
 [variablelist

[[Effects:] [If any threads are currently __blocked__ waiting on `*this` in a call
-to `wait` or `timed_wait`, unblocks all of those threads.]]
-
-[[Throws:] [Nothing.]]
+to `wait` or `timed_wait`, unblocks all of those threads.\n
+如果有线程当前因在 `wait` 或 `timed_wait` 中等待 `*this` 而 __blocked__,这 个函数调用会解除所有这些线程的阻塞状态。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -400,13 +458,19 @@
`this->notify_all()`, or spuriously. When the thread is unblocked (for whatever reason), the lock is reacquired by invoking `lock.lock()` before the call to `wait` returns. The lock is also reacquired by invoking `lock.lock()` if the
-function exits with an exception.]]
-
-[[Postcondition:] [`lock` is locked by the current thread.]]
+function exits with an exception.\n
+自动调用 `lock.unlock()` 并且阻塞当前线程。线程在 `this->notify_one()` 或 `this->notify_all()` 调用通知后解除阻塞状态。 +当线程被解除阻塞(不论任何原因)时,在 `wait` 函数退出前调用 `lock.lock()` 来 加锁。
+如果这个函数因为异常退出,退出前也会调用 `lock.lock()`。]]
+
+[[Postcondition:] [`lock` is locked by the current thread.\n
+当前线程锁定 `lock`。]]

 [[Throws:] [__thread_resource_error__ if an error
 occurs. __thread_interrupted__ if the wait was interrupted by a call to
-__interrupt__ on the __thread__ object associated with the current thread of execution.]] +__interrupt__ on the __thread__ object associated with the current thread of execution.\n +如果出错则抛出异常 __thread_resource_error__。如果对线程执行体关联的 __thread__ 对象调用 __interrupt__,
+抛出 __thread_interrupted__ 异常。]]

 ]

@@ -416,7 +480,8 @@

 [variablelist

-[[Effects:] [As-if ``
+[[Effects:] [As-if \n
+相当于 ``
 while(!pred())
 {
     wait(lock);
@@ -437,16 +502,24 @@
would be equal to or later than the specified `abs_time`, or spuriously. When
 the thread is unblocked (for whatever reason), the lock is reacquired by
 invoking `lock.lock()` before the call to `wait` returns. The lock is also
-reacquired by invoking `lock.lock()` if the function exits with an exception.]] +reacquired by invoking `lock.lock()` if the function exits with an exception.\n +自动调用 `lock.unlock()` 并且阻塞当前线程。线程在 `this->notify_one()` 或 `this->notify_all()` 调用通知后, +或当 `boost::get_system_time()` 所报告的时间等于或后于给定的 `abs_time` 时 解除阻塞状态。 +当线程被解除阻塞(不论任何原因)时,在 `wait` 函数退出前调用 `lock.lock()` 来 加锁。
+如果这个函数因为异常退出,退出前也会调用 `lock.lock()`。]]

 [[Returns:] [`false` if the call is returning because the time specified by
-`abs_time` was reached, `true` otherwise.]]
-
-[[Postcondition:] [`lock` is locked by the current thread.]]
+`abs_time` was reached, `true` otherwise.\n
+如果函数因为 `abs_time` 到达而退出,返回 `false`,否则 `true`。]]
+
+[[Postcondition:] [`lock` is locked by the current thread.\n
+当前线程锁定 `lock`。]]

 [[Throws:] [__thread_resource_error__ if an error
 occurs. __thread_interrupted__ if the wait was interrupted by a call to
-__interrupt__ on the __thread__ object associated with the current thread of execution.]] +__interrupt__ on the __thread__ object associated with the current thread of execution.\n +如果出错则抛出异常 __thread_resource_error__。如果对线程执行体关联的 __thread__ 对象调用 __interrupt__,
+抛出 __thread_interrupted__ 异常。]]

 ]

@@ -462,20 +535,28 @@
argument has elapsed, or spuriously. When the thread is unblocked (for whatever reason), the lock is reacquired by invoking `lock.lock()` before the call to `wait` returns. The lock is also reacquired by invoking `lock.lock()` if the
-function exits with an exception.]]
+function exits with an exception.\n
+自动调用 `lock.unlock()` 并且阻塞当前线程。线程在 `this->notify_one()` 或 `this->notify_all()` 调用通知后, +或当 `rel_time` 所表示的时间已过去时解除阻塞状态。当线程被解除阻塞(不论任何 原因)时,在 `wait` 函数退出前调用 `lock.lock()` 来加锁。
+如果这个函数因为异常退出,退出前也会调用 `lock.lock()`。]]

[[Returns:] [`false` if the call is returning because the time period specified
-by `rel_time` has elapsed, `true` otherwise.]]
-
-[[Postcondition:] [`lock` is locked by the current thread.]]
+by `rel_time` has elapsed, `true` otherwise.\n
+如果函数因为 `rel_time` 过去而退出,返回 `false`,否则 `true`。]]
+
+[[Postcondition:] [`lock` is locked by the current thread.\n
+当前线程锁定 `lock`。]]

 [[Throws:] [__thread_resource_error__ if an error
 occurs. __thread_interrupted__ if the wait was interrupted by a call to
-__interrupt__ on the __thread__ object associated with the current thread of execution.]] +__interrupt__ on the __thread__ object associated with the current thread of execution.\n +如果出错则抛出异常 __thread_resource_error__。如果对线程执行体关联的 __thread__ 对象调用 __interrupt__,
+抛出 __thread_interrupted__ 异常。]]

 ]

-[note The duration overload of timed_wait is difficult to use correctly. The overload taking a predicate should be preferred in most cases.] +[note The duration overload of timed_wait is difficult to use correctly. The overload taking a predicate should be preferred in most cases.\n +使用时间段参数的 timed_wait 函数难以正确使用,通常情况下带断言的重载比较容 易使用。]

 [endsect]

@@ -483,7 +564,8 @@

 [variablelist

-[[Effects:] [As-if ``
+[[Effects:] [As-if \n
+相当于 ``
 while(!pred())
 {
     if(!timed_wait(lock,abs_time))
@@ -506,7 +588,8 @@

     typedef condition_variable_any condition;

-The typedef `condition` is provided for backwards compatibility with previous boost releases. +The typedef `condition` is provided for backwards compatibility with previous boost releases.\n
+typedef `condition` 提供对以前版本的兼容。

 [endsect]

=======================================
--- /trunk/libs/thread/doc/future_ref.qbk       Mon Dec 28 23:05:14 2009
+++ /trunk/libs/thread/doc/future_ref.qbk       Sun Feb  7 05:34:27 2010
@@ -5,7 +5,7 @@
   http://www.boost.org/LICENSE_1_0.txt).
 ]

-[section:reference Futures Reference]
+[section:reference Futures Reference  Futures参考手册]

 [section:future_state `state` enum]

@@ -52,73 +52,90 @@
         bool timed_wait_until(boost::system_time const& abs_time) const;
     };

-[section:default_constructor Default Constructor]
+[section:default_constructor Default Constructor 缺省构造函数]

     unique_future();

 [variablelist

-[[Effects:] [Constructs an uninitialized future.]]
+[[Effects:] [Constructs an uninitialized future.\n
+构造一个未初始化的期货。]]

[[Postconditions:] [[unique_future_is_ready_link `this->is_ready`] returns `false`. [unique_future_get_state_link
-`this->get_state()`] returns __uninitialized__.]]
-
-[[Throws:] [Nothing.]]
+`this->get_state()`] returns __uninitialized__.\n
+[unique_future_is_ready_link `this->is_ready`] 返回 `false`。
+[unique_future_get_state_link `this->get_state()`] 返回 __uninitialized__。 ]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

 [endsect]

-[section:destructor Destructor]
+[section:destructor Destructor 析构函数]

     ~unique_future();

 [variablelist

-[[Effects:] [Destroys `*this`.]]
-
-[[Throws:] [Nothing.]]
+[[Effects:] [Destroys `*this`.\n
+销毁 `*this`。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

 [endsect]

-[section:move_constructor Move Constructor]
+[section:move_constructor Move Constructor 转移构造函数]

     unique_future(unique_future && other);

 [variablelist

-[[Effects:] [Constructs a new future, and transfers ownership of the asynchronous result associated with `other` to `*this`.]] +[[Effects:] [Constructs a new future, and transfers ownership of the asynchronous result associated with `other` to `*this`.\n
+构造一个新期货,并将与 `other` 相关联的异步结果的所有权转移给 `*this`。]]

[[Postconditions:] [[unique_future_get_state_link `this->get_state()`] returns the value of `other->get_state()` prior to the call. `other->get_state()` returns __uninitialized__. If `other` was associated with an asynchronous result, that result is now -associated with `*this`. `other` is not associated with any asynchronous result.]]
-
-[[Throws:] [Nothing.]]
-
-[[Notes:] [If the compiler does not support rvalue-references, this is implemented using the boost.thread move emulation.]] +associated with `*this`. `other` is not associated with any asynchronous result.\n +[unique_future_get_state_link `this->get_state()`] 返回调用之前的 `other->get_state()` 的值。`other->get_state()` 返回 +__uninitialized__。如果 `other` 与某个异步结果相关联,则该结果现在关联至 `*this`。`other` 不再关联任何异步结果。]]
+
+[[Throws:] [Nothing.\n
+无。]]
+
+[[Notes:] [If the compiler does not support rvalue-references, this is implemented using the boost.thread move emulation.\n
+如果编译器不支持右值引用,则使用 boost.thread 的转移仿真来实现。]]

 ]

 [endsect]

-[section:move_assignment Move Assignment Operator]
+[section:move_assignment Move Assignment Operator 转移赋值操作符]

     unique_future& operator=(unique_future && other);

 [variablelist

-[[Effects:] [Transfers ownership of the asynchronous result associated with `other` to `*this`.]] +[[Effects:] [Transfers ownership of the asynchronous result associated with `other` to `*this`.\n
+将与 `other` 相关联的异步结果的所有权转移至 `*this`。]]

[[Postconditions:] [[unique_future_get_state_link `this->get_state()`] returns the value of `other->get_state()` prior to the call. `other->get_state()` returns __uninitialized__. If `other` was associated with an asynchronous result, that result is now associated with `*this`. `other` is not associated with any asynchronous result. If `*this` was associated with an asynchronous -result prior to the call, that result no longer has an associated __unique_future__ instance.]]
-
-[[Throws:] [Nothing.]]
-
-[[Notes:] [If the compiler does not support rvalue-references, this is implemented using the boost.thread move emulation.]] +result prior to the call, that result no longer has an associated __unique_future__ instance.\n +[unique_future_get_state_link `this->get_state()`] 返回调用之前的 `other->get_state()` 的值。`other->get_state()` 返回 +__uninitialized__。如果 `other` 与某个异步结果相关联,则该结果现在关联至 `*this`。`other` 不再关联任何异步结果。 +如果在调用之前 `*this` 与某个异步结果相关联,则该结果不再有相关联的 __unique_future__ 实例。]]
+
+[[Throws:] [Nothing.\n
+无。]]
+
+[[Notes:] [If the compiler does not support rvalue-references, this is implemented using the boost.thread move emulation.\n
+如果编译器不支持右值引用,则使用 boost.thread 的转移仿真来实现。]]

 ]

@@ -130,14 +147,19 @@

 [variablelist

-[[Effects:] [Swaps ownership of the asynchronous results associated with `other` and `*this`.]] +[[Effects:] [Swaps ownership of the asynchronous results associated with `other` and `*this`.\n
+交换 `other` 和 `*this` 所关联的异步结果的所有权。]]

[[Postconditions:] [[unique_future_get_state_link `this->get_state()`] returns the value of `other->get_state()` prior to the call. `other->get_state()` returns the value of `this->get_state()` prior to the call. If `other` was associated with an asynchronous result, that result is now associated with `*this`, otherwise `*this` has no associated result. If `*this` was -associated with an asynchronous result, that result is now associated with `other`, otherwise `other` has no associated result.]]
-
-[[Throws:] [Nothing.]]
+associated with an asynchronous result, that result is now associated with `other`, otherwise `other` has no associated result.\n +[unique_future_get_state_link `this->get_state()`] 返回调用之前的 `other->get_state()` 的值。`other->get_state()` 返回调用之前的 +`this->get_state()` 的值。如果 `other` 与某个异步结果相关联,则该结果现在关 联至 `*this`,否则 `*this` 没有所关联的结果。 +如果 `*this` 之前与某个异步结果相关联,则该结果现在关联至 `other`,否则 `other` 没有所关联的结果。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -153,19 +175,25 @@
 [variablelist

[[Effects:] [If `*this` is associated with an asynchronous result, waits until the result is ready as-if by a call to -__unique_future_wait__, and retrieves the result (whether that is a value or an exception).]] +__unique_future_wait__, and retrieves the result (whether that is a value or an exception).\n +如果 `*this` 关联于某个异步结果,则等待至该结果准备好,就如调用 __unique_future_wait__,并取出该结果(不论是一个值还是一个异常)。]]

[[Returns:] [If the result type `R` is a reference, returns the stored reference. If `R` is `void`, there is no return -value. Otherwise, returns an rvalue-reference to the value stored in the asynchronous result.]] +value. Otherwise, returns an rvalue-reference to the value stored in the asynchronous result.\n +如果结果类型 `R` 是一个引用,则返回所保存的引用。如果 `R` 为 `void`,则没有 返回值。否则,返回保存在异步结果中的值的右值引用。]]

[[Postconditions:] [[unique_future_is_ready_link `this->is_ready()`] returns `true`. [unique_future_get_state_link
-`this->get_state()`] returns __ready__.]]
+`this->get_state()`] returns __ready__.\n
+[unique_future_is_ready_link `this->is_ready()`] 返回 `true`。 [unique_future_get_state_link `this->get_state()`] 返回 __ready__。]]

[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception stored in the
-asynchronous result in place of a value.]]
-
-[[Notes:] [`get()` is an ['interruption point].]]
+asynchronous result in place of a value.\n
+如果 `*this` 不关联异步结果,则抛出 __future_uninitialized__。如果与 `*this` 关联的结果在调用时未准备好,则抛出 __thread_interrupted__,
+且当前线程被中断。任何异常均被保存在异步结果中,替代结果值。]]
+
+[[Notes:] [`get()` is an ['interruption point].\n
+`get()` 是一个 ['中断点]。]]

 ]

@@ -178,16 +206,22 @@
 [variablelist

[[Effects:] [If `*this` is associated with an asynchronous result, waits until the result is ready. If the result is not ready on -entry, and the result has a ['wait callback] set, that callback is invoked prior to waiting.]] +entry, and the result has a ['wait callback] set, that callback is invoked prior to waiting.\n +如果 `*this` 关联于某个异步结果,则等待直至该结果准备好。如果在入口处结果未 准备好,且该结果有一个['等待回调]集合,
+则在等待之前执行回调。]]

[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
-['wait callback] if such a callback is called.]]
+['wait callback] if such a callback is called.\n
+如果 `*this` 不关联异步结果,则抛出 __future_uninitialized__。如果与 `*this` 关联的结果在调用时未准备好,则抛出 __thread_interrupted__, +且当前线程被中断。如果某个回调被调用,则任何由['等待回调]抛出的异常也会被抛 出。]]

[[Postconditions:] [[unique_future_is_ready_link `this->is_ready()`] returns `true`. [unique_future_get_state_link
-`this->get_state()`] returns __ready__.]]
-
-[[Notes:] [`wait()` is an ['interruption point].]]
+`this->get_state()`] returns __ready__.\n
+[unique_future_is_ready_link `this->is_ready()`] 返回 `true`. [unique_future_get_state_link `this->get_state()`] 返回 __ready__。]]
+
+[[Notes:] [`wait()` is an ['interruption point].\n
+`wait()` 是一个 ['中断点]。]]

 ]

@@ -202,19 +236,26 @@

[[Effects:] [If `*this` is associated with an asynchronous result, waits until the result is ready, or the time specified by `wait_duration` has elapsed. If the result is not ready on entry, and the result has a ['wait callback] set, that callback is
-invoked prior to waiting.]]
+invoked prior to waiting.\n
+如果 `*this` 关联于某个异步结果,则等待直至该结果准备好,或是达到由 `wait_duration` 给定的时间。如果在入口处结果未准备好,
+且该结果有一个['等待回调]集合,则在等待之前执行回调。]]

[[Returns:] [`true` if `*this` is associated with an asynchronous result, and that result is ready before the specified time has
-elapsed, `false` otherwise.]]
+elapsed, `false` otherwise.\n
+如果 `*this` 关联于某个异步结果且在指定时间到达之前结果准备好,则返回 `true`,否则返回 `false`。]]

[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
-['wait callback] if such a callback is called.]]
+['wait callback] if such a callback is called.\n
+如果 `*this` 不关联异步结果,则抛出 __future_uninitialized__。如果与 `*this` 关联的结果在调用时未准备好,则抛出 __thread_interrupted__, +且当前线程被中断。如果某个回调被调用,则任何由['等待回调]抛出的异常也会被抛 出。]]

[[Postconditions:] [If this call returned `true`, then [unique_future_is_ready_link `this->is_ready()`] returns `true` and
-[unique_future_get_state_link `this->get_state()`] returns __ready__.]]
-
-[[Notes:] [`timed_wait()` is an ['interruption point]. `Duration` must be a type that meets the Boost.DateTime time duration requirements.]]
+[unique_future_get_state_link `this->get_state()`] returns __ready__.\n
+[unique_future_is_ready_link `this->is_ready()`] 返回 `true`. [unique_future_get_state_link `this->get_state()`] 返回 __ready__。]]
+
+[[Notes:] [`timed_wait()` is an ['interruption point]. `Duration` must be a type that meets the Boost.DateTime time duration requirements.\n +`timed_wait()` 是一个 ['中断点]。`Duration` 必须是一个满足 Boost.DateTime 时间长度要求的类型。]]

 ]

@@ -228,19 +269,27 @@

[[Effects:] [If `*this` is associated with an asynchronous result, waits until the result is ready, or the time point specified by `wait_timeout` has passed. If the result is not ready on entry, and the result has a ['wait callback] set, that callback is invoked
-prior to waiting.]]
+prior to waiting.\n
+如果 `*this` 关联于某个异步结果,则等待直至该结果准备好,或是由 `wait_timeout` 给定的时间点已过。如果在入口处结果未准备好,
+且该结果有一个['等待回调]集合,则在等待之前执行回调。]]

[[Returns:] [`true` if `*this` is associated with an asynchronous result, and that result is ready before the specified time has
-passed, `false` otherwise.]]
+passed, `false` otherwise.\n
+如果 `*this` 关联于某个异步结果且在指定时间到达之前结果准备好,则返回 `true`,否则返回 `false`。]]

[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
-['wait callback] if such a callback is called.]]
+['wait callback] if such a callback is called.\n
+如果 `*this` 不关联异步结果,则抛出 __future_uninitialized__。如果与 `*this` 关联的结果在调用时未准备好,则抛出 __thread_interrupted__, +且当前线程被中断。如果某个回调被调用,则任何由['等待回调]抛出的异常也会被抛 出。]]

[[Postconditions:] [If this call returned `true`, then [unique_future_is_ready_link `this->is_ready()`] returns `true` and
-[unique_future_get_state_link `this->get_state()`] returns __ready__.]]
-
-[[Notes:] [`timed_wait()` is an ['interruption point].]]
+[unique_future_get_state_link `this->get_state()`] returns __ready__.\n
+如果该调用返回 `true`,则 [unique_future_is_ready_link `this->is_ready()`] 返回 `true` 且
+[unique_future_get_state_link `this->get_state()`] 返回 __ready__。]]
+
+[[Notes:] [`timed_wait()` is an ['interruption point].\n
+`timed_wait()` 是一个 ['中断点]。]]

 ]

@@ -253,12 +302,15 @@

 [variablelist

-[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set.]] +[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set.\n
+检查与 `*this` 相关联的异步结果是否被设置。]]

[[Returns:] [`true` if `*this` is associated with an asynchronous result, and that result is ready for retrieval, `false`
-otherwise.]]
-
-[[Throws:] [Nothing.]]
+otherwise.\n
+如果 `*this` 关联于某个异步结果且该结果已准备好被提取,则返回 `true`,否则 返回 `false`。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -270,12 +322,15 @@

 [variablelist

-[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set with a value rather than an exception.]] +[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set with a value rather than an exception.\n
+检查与 `*this` 相关联的异步结果是否被设置为一个值而不是一个异常。]]

[[Returns:] [`true` if `*this` is associated with an asynchronous result, that result is ready for retrieval, and the result is a
-stored value, `false` otherwise.]]
-
-[[Throws:] [Nothing.]]
+stored value, `false` otherwise.\n
+如果 `*this` 关联于某个异步结果且该结果已准备好被提取且结果为一个值,则返 回 `true`,否则返回 `false`。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -287,12 +342,15 @@

 [variablelist

-[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set with an exception rather than a value.]] +[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set with an exception rather than a value.\n
+检查与 `*this` 相关联的异步结果是否被设置为一个异常而不是一个值。]]

[[Returns:] [`true` if `*this` is associated with an asynchronous result, that result is ready for retrieval, and the result is a
-stored exception, `false` otherwise.]]
-
-[[Throws:] [Nothing.]]
+stored exception, `false` otherwise.\n
+如果 `*this` 关联于某个异步结果且该结果已准备好被提取且结果为一个异常,则返 回 `true`,否则返回 `false`。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -304,12 +362,16 @@

 [variablelist

-[[Effects:] [Determine the state of the asynchronous result associated with `*this`, if any.]] +[[Effects:] [Determine the state of the asynchronous result associated with `*this`, if any.\n
+判断与 `*this` 相关联的异步结果的状态,如果有的话。]]

[[Returns:] [__uninitialized__ if `*this` is not associated with an asynchronous result. __ready__ if the asynchronous result
-associated with `*this` is ready for retrieval, __waiting__ otherwise.]]
-
-[[Throws:] [Nothing.]]
+associated with `*this` is ready for retrieval, __waiting__ otherwise.\n
+如果 `*this` 不关联于某个异步结果,则返回 __uninitialized__。如果关联于 `*this` 的异步结果已准备好被提取,则返回 __ready__,
+否则返回 __waiting__。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -357,18 +419,22 @@
         bool timed_wait_until(boost::system_time const& abs_time) const;
     };

-[section:default_constructor Default Constructor]
+[section:default_constructor Default Constructor 缺省构造函数]

     shared_future();

 [variablelist

-[[Effects:] [Constructs an uninitialized future.]]
+[[Effects:] [Constructs an uninitialized future.\n
+构造一个未初始化的期货。]]

[[Postconditions:] [[shared_future_is_ready_link `this->is_ready`] returns `false`. [shared_future_get_state_link
-`this->get_state()`] returns __uninitialized__.]]
-
-[[Throws:] [Nothing.]]
+`this->get_state()`] returns __uninitialized__.\n
+[shared_future_is_ready_link `this->is_ready`] 返回 `false`。
+[shared_future_get_state_link `this->get_state()`] 返回 __uninitialized__。 ]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -381,15 +447,20 @@
 [variablelist

[[Effects:] [If `*this` is associated with an asynchronous result, waits until the result is ready as-if by a call to
-__shared_future_wait__, and returns a `const` reference to the result.]]
+__shared_future_wait__, and returns a `const` reference to the result.\n
+如果 `*this` 关联于某个异步结果,则等待至该结果准备好,就如调用 __shared_future_wait__,并返回该结果的一个 `const` 引用。]]

[[Returns:] [If the result type `R` is a reference, returns the stored reference. If `R` is `void`, there is no return -value. Otherwise, returns a `const` reference to the value stored in the asynchronous result.]] +value. Otherwise, returns a `const` reference to the value stored in the asynchronous result.\n +如果结果类型 `R` 是一个引用,则返回所保存的引用。如果 `R` 为 `void`,则没有 返回值。否则,返回保存在异步结果中的值的 `const` 引用。]]

[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the -result associated with `*this` is not ready at the point of the call, and the current thread is interrupted.]]
-
-[[Notes:] [`get()` is an ['interruption point].]]
+result associated with `*this` is not ready at the point of the call, and the current thread is interrupted.\n +如果 `*this` 不关联异步结果,则抛出 __future_uninitialized__。如果与 `*this` 关联的结果在调用时未准备好,则抛出 __thread_interrupted__,
+且当前线程被中断。]]
+
+[[Notes:] [`get()` is an ['interruption point].\n
+`get()` 是一个 ['中断点]。]]

 ]

@@ -402,16 +473,22 @@
 [variablelist

[[Effects:] [If `*this` is associated with an asynchronous result, waits until the result is ready. If the result is not ready on -entry, and the result has a ['wait callback] set, that callback is invoked prior to waiting.]] +entry, and the result has a ['wait callback] set, that callback is invoked prior to waiting.\n +如果 `*this` 关联于某个异步结果,则等待直至该结果准备好。如果在入口处结果未 准备好,且该结果有一个['等待回调]集合,
+则在等待之前执行回调。]]

[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
-['wait callback] if such a callback is called.]]
+['wait callback] if such a callback is called.\n
+如果 `*this` 不关联异步结果,则抛出 __future_uninitialized__。如果与 `*this` 关联的结果在调用时未准备好,则抛出 __thread_interrupted__, +且当前线程被中断。如果某个回调被调用,则任何由['等待回调]抛出的异常也会被抛 出。]]

[[Postconditions:] [[shared_future_is_ready_link `this->is_ready()`] returns `true`. [shared_future_get_state_link
-`this->get_state()`] returns __ready__.]]
-
-[[Notes:] [`wait()` is an ['interruption point].]]
+`this->get_state()`] returns __ready__.\n
+[shared_future_is_ready_link `this->is_ready()`] 返回 `true`. [shared_future_get_state_link `this->get_state()`] 返回 __ready__。]]
+
+[[Notes:] [`wait()` is an ['interruption point].\n
+`wait()` 是一个 ['中断点]。]]

 ]

@@ -426,19 +503,26 @@

[[Effects:] [If `*this` is associated with an asynchronous result, waits until the result is ready, or the time specified by `wait_duration` has elapsed. If the result is not ready on entry, and the result has a ['wait callback] set, that callback is
-invoked prior to waiting.]]
+invoked prior to waiting.\n
+如果 `*this` 关联于某个异步结果,则等待直至该结果准备好,或是达到由 `wait_duration` 给定的时间。如果在入口处结果未准备好,
+且该结果有一个['等待回调]集合,则在等待之前执行回调。]]

[[Returns:] [`true` if `*this` is associated with an asynchronous result, and that result is ready before the specified time has
-elapsed, `false` otherwise.]]
+elapsed, `false` otherwise.\n
+如果 `*this` 关联于某个异步结果且在指定时间到达之前结果准备好,则返回 `true`,否则返回 `false`。]]

[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
-['wait callback] if such a callback is called.]]
+['wait callback] if such a callback is called.\n
+如果 `*this` 不关联异步结果,则抛出 __future_uninitialized__。如果与 `*this` 关联的结果在调用时未准备好,则抛出 __thread_interrupted__, +且当前线程被中断。如果某个回调被调用,则任何由['等待回调]抛出的异常也会被抛 出。]]

[[Postconditions:] [If this call returned `true`, then [shared_future_is_ready_link `this->is_ready()`] returns `true` and
-[shared_future_get_state_link `this->get_state()`] returns __ready__.]]
-
-[[Notes:] [`timed_wait()` is an ['interruption point]. `Duration` must be a type that meets the Boost.DateTime time duration requirements.]]
+[shared_future_get_state_link `this->get_state()`] returns __ready__.\n
+[shared_future_is_ready_link `this->is_ready()`] 返回 `true`. [shared_future_get_state_link `this->get_state()`] 返回 __ready__。]]
+
+[[Notes:] [`timed_wait()` is an ['interruption point]. `Duration` must be a type that meets the Boost.DateTime time duration requirements.\n +`timed_wait()` 是一个 ['中断点]。`Duration` 必须是一个满足 Boost.DateTime 时间长度要求的类型。]]

 ]

@@ -452,19 +536,27 @@

[[Effects:] [If `*this` is associated with an asynchronous result, waits until the result is ready, or the time point specified by `wait_timeout` has passed. If the result is not ready on entry, and the result has a ['wait callback] set, that callback is invoked
-prior to waiting.]]
+prior to waiting.\n
+如果 `*this` 关联于某个异步结果,则等待直至该结果准备好,或是由 `wait_timeout` 给定的时间点已过。如果在入口处结果未准备好,
+且该结果有一个['等待回调]集合,则在等待之前执行回调。]]

[[Returns:] [`true` if `*this` is associated with an asynchronous result, and that result is ready before the specified time has
-passed, `false` otherwise.]]
+passed, `false` otherwise.\n
+如果 `*this` 关联于某个异步结果且在指定时间到达之前结果准备好,则返回 `true`,否则返回 `false`。]]

[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
-['wait callback] if such a callback is called.]]
+['wait callback] if such a callback is called.\n
+如果 `*this` 不关联异步结果,则抛出 __future_uninitialized__。如果与 `*this` 关联的结果在调用时未准备好,则抛出 __thread_interrupted__, +且当前线程被中断。如果某个回调被调用,则任何由['等待回调]抛出的异常也会被抛 出。]]

[[Postconditions:] [If this call returned `true`, then [shared_future_is_ready_link `this->is_ready()`] returns `true` and
-[shared_future_get_state_link `this->get_state()`] returns __ready__.]]
-
-[[Notes:] [`timed_wait()` is an ['interruption point].]]
+[shared_future_get_state_link `this->get_state()`] returns __ready__.\n
+如果该调用返回 `true`,则 [unique_future_is_ready_link `this->is_ready()`] 返回 `true` 且
+[unique_future_get_state_link `this->get_state()`] 返回 __ready__。]]
+
+[[Notes:] [`timed_wait()` is an ['interruption point].\n
+`timed_wait()` 是一个 ['中断点]。]]

 ]

@@ -476,12 +568,15 @@

 [variablelist

-[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set.]] +[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set.\n
+检查与 `*this` 相关联的异步结果是否被设置。]]

[[Returns:] [`true` if `*this` is associated with an asynchronous result, and that result is ready for retrieval, `false`
-otherwise.]]
-
-[[Throws:] [Nothing.]]
+otherwise.\n
+如果 `*this` 关联于某个异步结果且该结果已准备好被提取,则返回 `true`,否则 返回 `false`。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -493,12 +588,15 @@

 [variablelist

-[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set with a value rather than an exception.]] +[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set with a value rather than an exception.\n
+检查与 `*this` 相关联的异步结果是否被设置为一个值而不是一个异常。]]

[[Returns:] [`true` if `*this` is associated with an asynchronous result, that result is ready for retrieval, and the result is a
-stored value, `false` otherwise.]]
-
-[[Throws:] [Nothing.]]
+stored value, `false` otherwise.\n
+如果 `*this` 关联于某个异步结果且该结果已准备好被提取且结果为一个值,则返 回 `true`,否则返回 `false`。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -510,12 +608,15 @@

 [variablelist

-[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set with an exception rather than a value.]] +[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set with an exception rather than a value.\n
+检查与 `*this` 相关联的异步结果是否被设置为一个异常而不是一个值。]]

[[Returns:] [`true` if `*this` is associated with an asynchronous result, that result is ready for retrieval, and the result is a
-stored exception, `false` otherwise.]]
-
-[[Throws:] [Nothing.]]
+stored exception, `false` otherwise.\n
+如果 `*this` 关联于某个异步结果且该结果已准备好被提取且结果为一个异常,则返 回 `true`,否则返回 `false`。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -527,12 +628,16 @@

 [variablelist

-[[Effects:] [Determine the state of the asynchronous result associated with `*this`, if any.]] +[[Effects:] [Determine the state of the asynchronous result associated with `*this`, if any.\n
+判断与 `*this` 相关联的异步结果的状态,如果有的话。]]

[[Returns:] [__uninitialized__ if `*this` is not associated with an asynchronous result. __ready__ if the asynchronous result
-associated with `*this` is ready for retrieval, __waiting__ otherwise.]]
-
-[[Throws:] [Nothing.]]
+associated with `*this` is ready for retrieval, __waiting__ otherwise.\n
+如果 `*this` 不关联于某个异步结果,则返回 __uninitialized__。如果关联于 `*this` 的异步结果已准备好被提取,则返回 __ready__,
+否则返回 __waiting__。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -571,38 +676,43 @@
         void set_wait_callback(F f);
     };

-[section:default_constructor Default Constructor]
+[section:default_constructor Default Constructor 缺省构造函数]

     promise();

 [variablelist

-[[Effects:] [Constructs a new __promise__ with no associated result.]]
-
-[[Throws:] [Nothing.]]
+[[Effects:] [Constructs a new __promise__ with no associated result.\n
+构造一个不带关联结果的新 __promise__。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

 [endsect]

-[section:move_constructor Move Constructor]
+[section:move_constructor Move Constructor 转移构造函数]

     promise(promise && other);

 [variablelist

[[Effects:] [Constructs a new __promise__, and transfers ownership of the result associated with `other` to `*this`, leaving `other`
-with no associated result.]]
-
-[[Throws:] [Nothing.]]
-
-[[Notes:] [If the compiler does not support rvalue-references, this is implemented using the boost.thread move emulation.]]
+with no associated result.\n
+构造一个新的 __promise__,并将与 `other` 关联的结果的所有权转移至 `*this`,`other` 则不再关联结果。]]
+
+[[Throws:] [Nothing.\n
+无。]]
+
+[[Notes:] [If the compiler does not support rvalue-references, this is implemented using the boost.thread move emulation.\n
+如果编译器不支持右值引用,则使用 boost.thread 的转移仿真来实现。]]

 ]

 [endsect]

-[section:move_assignment Move Assignment Operator]
+[section:move_assignment Move Assignment Operator 转移赋值操作符]

     promise& operator=(promise && other);

@@ -610,26 +720,33 @@

[[Effects:] [Transfers ownership of the result associated with `other` to `*this`, leaving `other` with no associated result. If there was already a result associated with `*this`, and that result was not ['ready], sets any futures associated with that result to
-['ready] with a __broken_promise__ exception as the result. ]]
-
-[[Throws:] [Nothing.]]
-
-[[Notes:] [If the compiler does not support rvalue-references, this is implemented using the boost.thread move emulation.]]
+['ready] with a __broken_promise__ exception as the result. \n
+将与 `other` 关联的结果的所有权转移至 `*this`,`other` 不再关联结果。如果 `*this` 已经带有关联结果,则该结果不再['准备好], +将与该结果相关联的任何期货设置为['准备好],以 __broken_promise__ 异常作为结 果。]]
+
+[[Throws:] [Nothing.\n
+无。]]
+
+[[Notes:] [If the compiler does not support rvalue-references, this is implemented using the boost.thread move emulation.\n
+如果编译器不支持右值引用,则使用 boost.thread 的转移仿真来实现。]]

 ]

 [endsect]

-[section:destructor Destructor]
+[section:destructor Destructor 析构函数]

     ~promise();

 [variablelist

[[Effects:] [Destroys `*this`. If there was a result associated with `*this`, and that result is not ['ready], sets any futures -associated with that task to ['ready] with a __broken_promise__ exception as the result.]]
-
-[[Throws:] [Nothing.]]
+associated with that task to ['ready] with a __broken_promise__ exception as the result.\n +销毁 `*this`。如果有某个结果关联于 `*this`,则该结果不再['准备好],将与该结 果相关联的任何期货设置为['准备好],
+以 __broken_promise__ 异常作为结果。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -642,10 +759,13 @@
 [variablelist

[[Effects:] [If `*this` was not associated with a result, allocate storage for a new asynchronous result and associate it with -`*this`. Returns a __unique_future__ associated with the result associated with `*this`. ]] +`*this`. Returns a __unique_future__ associated with the result associated with `*this`. \n +如果 `*this` 不关联于某个结果,则分配一个新的异步结果的内存并将它关联至 `*this`。返回一个关联了与 `*this` 相关联的结果的
+__unique_future__。]]

[[Throws:] [__future_already_retrieved__ if the future associated with the task has already been retrieved. `std::bad_alloc` if any
-memory necessary could not be allocated.]]
+memory necessary could not be allocated.\n
+如果与该任务相关联的期货已被取出,则抛出 __future_already_retrieved__。如果 没有内存可分配,则抛出 `std::bad_alloc`。]]

 ]

@@ -662,13 +782,18 @@

[[Effects:] [If `*this` was not associated with a result, allocate storage for a new asynchronous result and associate it with `*this`. Store the value `r` in the asynchronous result associated with `*this`. Any threads blocked waiting for the asynchronous
-result are woken.]]
+result are woken.\n
+如果 `*this` 没有关联至某个结果,则分配一个新的异步结果的内存并将它关联至 `*this`。将值 `r` 保存到与 `*this` 相关联的异步结果中。
+所有因等待该异步结果而阻塞的线程被唤醒。]]

[[Postconditions:] [All futures waiting on the asynchronous result are ['ready] and __unique_future_has_value__ or
-__shared_future_has_value__ for those futures shall return `true`.]]
+__shared_future_has_value__ for those futures shall return `true`.\n
+所有在该异步结果上等待的期货变为['准备好],且这些期货的 __unique_future_has_value__ 或 __shared_future_has_value__ 返回 `true`。]]

[[Throws:] [__promise_already_satisfied__ if the result associated with `*this` is already ['ready]. `std::bad_alloc` if the memory -required for storage of the result cannot be allocated. Any exception thrown by the copy or move-constructor of `R`.]] +required for storage of the result cannot be allocated. Any exception thrown by the copy or move-constructor of `R`.\n +如果关联于 `*this` 的结果已['准备好],则抛出 __promise_already_satisfied__。如果没有内存可分配,则抛出 `std::bad_alloc`。
+由 `R` 的复制或转移构造函数所抛出的任何异常都会被抛出。]]

 ]

@@ -682,13 +807,17 @@

[[Effects:] [If `*this` was not associated with a result, allocate storage for a new asynchronous result and associate it with `*this`. Store the exception `e` in the asynchronous result associated with `*this`. Any threads blocked waiting for the asynchronous
-result are woken.]]
+result are woken.\n
+如果 `*this` 没有关联至某个结果,则分配一个新的异步结果的内存并将它关联至 `*this`。将异常 `e` 保存到与 `*this` 相关联的异步结果中。
+所有因等待该异步结果而阻塞的线程被唤醒。]]

[[Postconditions:] [All futures waiting on the asynchronous result are ['ready] and __unique_future_has_exception__ or
-__shared_future_has_exception__ for those futures shall return `true`.]]
+__shared_future_has_exception__ for those futures shall return `true`.\n
+所有在该异步结果上等待的期货变为['准备好],且这些期货的 __unique_future_has_exception__ 或 __shared_future_has_exception__ 返回 `true`。]]

[[Throws:] [__promise_already_satisfied__ if the result associated with `*this` is already ['ready]. `std::bad_alloc` if the memory
-required for storage of the result cannot be allocated.]]
+required for storage of the result cannot be allocated.\n
+如果关联于 `*this` 的结果已['准备好],则抛出 __promise_already_satisfied__。如果没有内存可分配,则抛出 `std::bad_alloc`。 ]]

 ]

@@ -702,13 +831,18 @@
 [variablelist

[[Preconditions:] [The expression `f(t)` where `t` is a lvalue of type __packaged_task__ shall be well-formed. Invoking a copy of
-`f` shall have the same effect as invoking `f`]]
+`f` shall have the same effect as invoking `f`\n
+表达式 `f(t)` 有良好定义,其中 `t` 是 __packaged_task__ 类型的左值。执行 `f` 的拷贝与执行 `f` 有相同的效果。]]

[[Effects:] [Store a copy of `f` with the asynchronous result associated with `*this` as a ['wait callback]. This will replace any existing wait callback store alongside that result. If a thread subsequently calls one of the wait functions on a __unique_future__ -or __shared_future__ associated with this result, and the result is not ['ready], `f(*this)` shall be invoked.]]
-
-[[Throws:] [`std::bad_alloc` if memory cannot be allocated for the required storage.]] +or __shared_future__ associated with this result, and the result is not ['ready], `f(*this)` shall be invoked.\n +将 `f` 的一份拷贝保存为与 `*this` 相关联的异步结果的一个['等待回调]。它将替 代任何已保存在该结果中的等待回调。 +如果此后一个线程在与此结果相关联的一个 __unique_future__ 或 __shared_future__ 上调用该等待回调,且该结果未['准备好],
+则 `f(*this)` 被执行。]]
+
+[[Throws:] [`std::bad_alloc` if memory cannot be allocated for the required storage.\n
+如果没有内存可分配,则抛出 `std::bad_alloc`。]]

 ]

@@ -757,7 +891,7 @@
         void set_wait_callback(F f);
     };

-[section:task_constructor Task Constructor]
+[section:task_constructor Task Constructor 任务构造函数]

     template<typename F>
     packaged_task(F const &f);
@@ -770,35 +904,41 @@
 [variablelist

[[Preconditions:] [`f()` is a valid expression with a return type convertible to `R`. Invoking a copy of `f` shall behave the same
-as invoking `f`.]]
-
-[[Effects:] [Constructs a new __packaged_task__ with a copy of `f` stored as the associated task.]]
+as invoking `f`.\n
+`f()` 是一个返回类型可转换为 `R` 的有效表达式。执行 `f` 的拷贝与执行 `f` 有 相同的行为。]]
+
+[[Effects:] [Constructs a new __packaged_task__ with a copy of `f` stored as the associated task.\n
+构造一个新的 __packaged_task__,将 `f` 的拷贝保存为关联任务。]]

[[Throws:] [Any exceptions thrown by the copy (or move) constructor of `f`. `std::bad_alloc` if memory for the internal data
-structures could not be allocated.]]
+structures could not be allocated.\n
+由 `f` 的复制(转移)构造函数所抛出的任何异常都会被抛出。如果没有内存可分配给 内部数据结构,则抛出 `std::bad_alloc`。]]

 ]

 [endsect]

-[section:move_constructor Move Constructor]
+[section:move_constructor Move Constructor 转移构造函数]

     packaged_task(packaged_task && other);

 [variablelist

[[Effects:] [Constructs a new __packaged_task__, and transfers ownership of the task associated with `other` to `*this`, leaving `other`
-with no associated task.]]
-
-[[Throws:] [Nothing.]]
-
-[[Notes:] [If the compiler does not support rvalue-references, this is implemented using the boost.thread move emulation.]]
+with no associated task.\n
+构造一个新的 __packaged_task__,并将与 `other` 相关联的任务的所有权转移至 `*this`,`other` 则不再有关联任务。]]
+
+[[Throws:] [Nothing.\n
+无。]]
+
+[[Notes:] [If the compiler does not support rvalue-references, this is implemented using the boost.thread move emulation.\n
+如果编译器不支持右值引用,则使用 boost.thread 的转移仿真来实现。]]

 ]

 [endsect]

-[section:move_assignment Move Assignment Operator]
+[section:move_assignment Move Assignment Operator 转移赋值操作符]

     packaged_task& operator=(packaged_task && other);

@@ -806,26 +946,33 @@

[[Effects:] [Transfers ownership of the task associated with `other` to `*this`, leaving `other` with no associated task. If there was already a task associated with `*this`, and that task has not been invoked, sets any futures associated with that task to
-['ready] with a __broken_promise__ exception as the result. ]]
-
-[[Throws:] [Nothing.]]
-
-[[Notes:] [If the compiler does not support rvalue-references, this is implemented using the boost.thread move emulation.]]
+['ready] with a __broken_promise__ exception as the result. \n
+将与 `other` 关联的任务的所有权转移至 `*this`,`other` 不再关联任务。如果 `*this` 已经带有关联任务,则该任务不再被执行, +将与该任务相关联的任何期货设置为['准备好],以 __broken_promise__ 异常作为结 果。]]
+
+[[Throws:] [Nothing.\n
+无。]]
+
+[[Notes:] [If the compiler does not support rvalue-references, this is implemented using the boost.thread move emulation.\n
+如果编译器不支持右值引用,则使用 boost.thread 的转移仿真来实现。]]

 ]

 [endsect]

-[section:destructor Destructor]
+[section:destructor Destructor 析构函数]

     ~packaged_task();

 [variablelist

[[Effects:] [Destroys `*this`. If there was a task associated with `*this`, and that task has not been invoked, sets any futures -associated with that task to ['ready] with a __broken_promise__ exception as the result.]]
-
-[[Throws:] [Nothing.]]
+associated with that task to ['ready] with a __broken_promise__ exception as the result.\n +销毁 `*this`。如果有某个任务关联于 `*this`,则该任务不再被执行,将与该任务 相关联的任何期货设置为['准备好],
+以 __broken_promise__ 异常作为结果。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -837,10 +984,13 @@

 [variablelist

-[[Effects:] [Returns a __unique_future__ associated with the result of the task associated with `*this`. ]] +[[Effects:] [Returns a __unique_future__ associated with the result of the task associated with `*this`. \n
+返回一个关联了与 `*this` 相关联的任务的 __unique_future__。]]

[[Throws:] [__task_moved__ if ownership of the task associated with `*this` has been moved to another instance of -__packaged_task__. __future_already_retrieved__ if the future associated with the task has already been retrieved.]] +__packaged_task__. __future_already_retrieved__ if the future associated with the task has already been retrieved.\n +如果与 `*this` 相关联的任务的所有权已经转移至另一个 __packaged_task__ 实 例,则抛出 __task_moved__。
+如果与该任务相关联的期货已被取出,则抛出 __future_already_retrieved__。]]

 ]

@@ -854,12 +1004,17 @@

[[Effects:] [Invoke the task associated with `*this` and store the result in the corresponding future. If the task returns normally, the return value is stored as the asynchronous result, otherwise the exception thrown is stored. Any threads blocked waiting for the
-asynchronous result associated with this task are woken.]]
-
-[[Postconditions:] [All futures waiting on the asynchronous result are ['ready]]]
+asynchronous result associated with this task are woken.\n
+执行与 `*this` 相关联的任务,并将结果保存在对应的期货中。如果该任务正常返 回,则返回值被保存为异步结果,否则保存被抛出的异常。
+所有因等待与该任务相关联的异步结果而阻塞的线程被唤醒。]]
+
+[[Postconditions:] [All futures waiting on the asynchronous result are ['ready]\n
+所有在该异步结果上等待的期货变为['准备好]。]]

[[Throws:] [__task_moved__ if ownership of the task associated with `*this` has been moved to another instance of -__packaged_task__. __task_already_started__ if the task has already been invoked.]] +__packaged_task__. __task_already_started__ if the task has already been invoked.\n +如果与 `*this` 相关联的任务的所有权已经转移至另一个 __packaged_task__ 实 例,则抛出 __task_moved__。
+如果该任务已被执行,则抛出 __task_already_started__。]]

 ]

@@ -873,14 +1028,19 @@
 [variablelist

[[Preconditions:] [The expression `f(t)` where `t` is a lvalue of type __packaged_task__ shall be well-formed. Invoking a copy of
-`f` shall have the same effect as invoking `f`]]
+`f` shall have the same effect as invoking `f`\n
+表达式 `f(t)` 有良好定义,其中 `t` 是 __packaged_task__ 类型的左值。执行 `f` 的拷贝与执行 `f` 有相同的效果。]]

[[Effects:] [Store a copy of `f` with the task associated with `*this` as a ['wait callback]. This will replace any existing wait callback store alongside that task. If a thread subsequently calls one of the wait functions on a __unique_future__ or -__shared_future__ associated with this task, and the result of the task is not ['ready], `f(*this)` shall be invoked.]] +__shared_future__ associated with this task, and the result of the task is not ['ready], `f(*this)` shall be invoked.\n +将 `f` 的一份拷贝以及与 `*this` 相关联的任务保存为一个['等待回调]。它将替代 任何已保存在该任务中的等待回调。 +如果此后一个线程在与此任务相关联的一个 __unique_future__ 或 __shared_future__ 上调用该等待回调,且该任务的结果未['准备好],
+则 `f(*this)` 被执行。]]

[[Throws:] [__task_moved__ if ownership of the task associated with `*this` has been moved to another instance of
-__packaged_task__.]]
+__packaged_task__.\n
+如果与 `*this` 相关联的任务的所有权已被转移至另一个 __packaged_task__ 实 例,则抛出 __task_moved__。]]

 ]

@@ -911,18 +1071,26 @@
 [[Preconditions:] [The types `Fn` shall be specializations of
 __unique_future__ or __shared_future__, and `Iterator` shall be a
 forward iterator with a `value_type` which is a specialization of
-__unique_future__ or __shared_future__.]]
-
-[[Effects:] [Waits until at least one of the specified futures is ['ready].]]
+__unique_future__ or __shared_future__.\n
+类型 `Fn` 应是 __unique_future__ 或 __shared_future__ 的特化,`Iterator` 应 是一个 `value_type` 为 __unique_future__ 或
+__shared_future__ 的特化类型的前向迭代器。]]
+
+[[Effects:] [Waits until at least one of the specified futures is ['ready].\n
+等待直至至少一个给定的期货变为['准备好]。]]

[[Returns:] [The range-based overload returns an `Iterator` identifying the first future in the range that was detected as ['ready]. The remaining overloads return the zero-based index of the first future that was detected as ['ready] (first parameter =>
-0, second parameter => 1, etc.).]]
+0, second parameter => 1, etc.).\n
+基于区间的重载版本将返回一个 `Iterator`,标识在区间中被测定为['准备好]的第 一个期货。其它重载版本则返回从零起计的索引, +指向被测定为['准备好]的第一个期货(第一个参数 => 0, 第二个参数 => 1, 等等)。 ]]

[[Throws:] [__thread_interrupted__ if the current thread is interrupted. Any exception thrown by the ['wait callback] associated -with any of the futures being waited for. `std::bad_alloc` if memory could not be allocated for the internal wait structures.]]
-
-[[Notes:] [`wait_for_any()` is an ['interruption point].]]
+with any of the futures being waited for. `std::bad_alloc` if memory could not be allocated for the internal wait structures.\n +如果当前线程被中断,则抛出 __thread_interrupted__。由任一正在被等待的期货相 关联的['等待回调]所抛出的任何异常都会被抛出。
+如果不能为内部等待结构分配内存,则抛出 `std::bad_alloc`。]]
+
+[[Notes:] [`wait_for_any()` is an ['interruption point].\n
+`wait_for_any()` 是一个 ['中断点]。]]

 ]

@@ -951,13 +1119,18 @@
 [[Preconditions:] [The types `Fn` shall be specializations of
 __unique_future__ or __shared_future__, and `Iterator` shall be a
 forward iterator with a `value_type` which is a specialization of
-__unique_future__ or __shared_future__.]]
-
-[[Effects:] [Waits until all of the specified futures are ['ready].]]
-
-[[Throws:] [Any exceptions thrown by a call to `wait()` on the specified futures.]]
-
-[[Notes:] [`wait_for_all()` is an ['interruption point].]]
+__unique_future__ or __shared_future__.\n
+类型 `Fn` 应是 __unique_future__ 或 __shared_future__ 的特化,`Iterator` 应 是一个 `value_type` 为 __unique_future__ 或
+__shared_future__ 的特化类型的前向迭代器。]]
+
+[[Effects:] [Waits until all of the specified futures are ['ready].\n
+等待直至所有给定的期货变为['准备好]。]]
+
+[[Throws:] [Any exceptions thrown by a call to `wait()` on the specified futures.\n
+由在给定期货上调用 `wait()` 所抛出的任何异常。]]
+
+[[Notes:] [`wait_for_all()` is an ['interruption point].\n
+`wait_for_all()` 是一个 ['中断点]。]]

 ]

=======================================
--- /trunk/libs/thread/doc/futures.qbk  Mon Dec 28 23:05:14 2009
+++ /trunk/libs/thread/doc/futures.qbk  Sun Feb  7 05:34:27 2010
@@ -5,7 +5,7 @@
   http://www.boost.org/LICENSE_1_0.txt).
 ]

-[section:futures Futures]
+[section:futures Futures 期货]

[template future_state_link[link_text] [link thread.synchronization.futures.reference.future_state [link_text]]] [def __uninitialized__ [future_state_link `boost::future_state::uninitialized`]]
@@ -77,36 +77,50 @@
 [def __wait_for_all__ [wait_for_all_link `boost::wait_for_all()`]]


-[section:overview Overview]
+[section:overview Overview 概览]

The futures library provides a means of handling synchronous future values, whether those values are generated by another thread, or
-on a single thread in response to external stimuli, or on-demand.
+on a single thread in response to external stimuli, or on-demand.\n
+期货库提供了一个处理同步未来值的手段,不论这些值是否由另一个线程产生,或是 在单个线程内响应外部的刺激或点播。

This is done through the provision of four class templates: __unique_future__ and __shared_future__ which are used to retrieve the -asynchronous results, and __promise__ and __packaged_task__ which are used to generate the asynchronous results. +asynchronous results, and __promise__ and __packaged_task__ which are used to generate the asynchronous results.\n +这是通过设立四个类模板来实现的:__unique_future__ 和 __shared_future__ 用于 取出异步结果,而 __promise__ 和 __packaged_task__
+则用于生成异步结果。

An instance of __unique_future__ holds the one and only reference to a result. Ownership can be transferred between instances using the move constructor or move-assignment operator, but at most one instance holds a reference to a given asynchronous result. When the result is ready, it is returned from __unique_future_get__ by rvalue-reference to allow the result to be moved or copied as
-appropriate for the type.
+appropriate for the type.\n
+一个 __unique_future__ 实例持有一个指向结果的引用,也仅有它引向该结果。通过 使用转移构造函数或转移赋值操作符,所有权可以在实例间转移, +但是最多只能有一个实例持有指向给定异步结果的引用。当该结果准备好以后,就可 以从 __unique_future_get__ 以右值引用的方式返回,
+以使该结果可以被以合适的类型进行转移或复制。

On the other hand, many instances of __shared_future__ may reference the same result. Instances can be freely copied and assigned, and __shared_future_get__ returns a `const` reference so that multiple calls to __shared_future_get__ are safe. You can move an instance of __unique_future__ into an instance of __shared_future__, thus transferring ownership of the associated asynchronous
-result, but not vice-versa.
-
-You can wait for futures either individually or with one of the __wait_for_any__ and __wait_for_all__ functions.
+result, but not vice-versa.\n
+另一方面,多个 __shared_future__ 可以引向同一个结果。这些实例可以自由地进行 复制和赋值,而 __shared_future_get__ 会返回一个 `const` +引用,因此多个 __shared_future_get__ 调用是安全的。你可以将一个 __unique_future__ 实例转移至另一个 __shared_future__ 实例,
+从而转移相关联的异步结果的所有权,但反之则不可以。
+
+You can wait for futures either individually or with one of the __wait_for_any__ and __wait_for_all__ functions.\n +你可以单独地,或是通过 __wait_for_any__ 和 __wait_for_all__ 函数之一来等待 期货。

 [endsect]

-[section:creating Creating asynchronous values]
+[section:creating Creating asynchronous values 创建异步值]

You can set the value in a future with either a __promise__ or a __packaged_task__. A __packaged_task__ is a callable object that wraps a function or callable object. When the packaged task is invoked, it invokes the contained function in turn, and populates a future with the return value. This is an answer to the perennial question: "how do I return a value from a thread?": package the function you wish to run as a __packaged_task__ and pass the packaged task to the thread constructor. The future retrieved from the packaged task can then be used to obtain the return value. If the function throws an exception, that is stored in the future in
-place of the return value.
+place of the return value.\n
+你可以通过一个 __promise__ 或 __packaged_task__ 来在期货中设置值。 __packaged_task__ 是一个可调用对象,它包装了某个函数或可调用对象。 +当这个打包任务被调用时,它转而调用内部的函数,并将返回值填入期货。这是对一 个老问题的答案:"我如何从一个线程返回一个值?": +将你想要运行的函数打包成一个 __packaged_task__,并将它传递给线程的构造函 数。然后,从打包任务中取出的期货就可以用于获得该返回值。
+如果该函数抛出一个异常,则该异常会取替返回值保存在期货中。

     int calculate_the_answer_to_life_the_universe_and_everything()
     {
@@ -129,7 +143,9 @@

A __promise__ is a bit more low level: it just provides explicit functions to store a value or an exception in the associated future. A promise can therefore be used where the value may come from more than one possible source, or where a single operation may
-produce multiple values.
+produce multiple values.\n
+__promise__ 则稍微底层一些:它只提供显式的函数来将一个值或一个异常保存到相 关联的期货中。因此,当这个值可能从多个地方返回时,
+或者是单个操作可能产生多个值时,可以使用允诺(promise)。

     boost::promise<int> pi;
     boost::unique_future<int> fi;
@@ -145,15 +161,20 @@

 [endsect]

-[section:lazy_futures Wait Callbacks and Lazy Futures]
+[section:lazy_futures Wait Callbacks and Lazy Futures 等待回调与延迟的期货]

Both __promise__ and __packaged_task__ support ['wait callbacks] that are invoked when a thread blocks in a call to `wait()` or `timed_wait()` on a future that is waiting for the result from the __promise__ or __packaged_task__, in the thread that is doing the -waiting. These can be set using the `set_wait_callback()` member function on the __promise__ or __packaged_task__ in question. +waiting. These can be set using the `set_wait_callback()` member function on the __promise__ or __packaged_task__ in question.\n +__promise__ 和 __packaged_task__ 均支持['等待回调],即当一个线程在一次对某 个期货的 `wait()` 或 `timed_wait()` 的调用中被阻塞时, +被调用的某个函数,该期货正在等待 __promise__ 或 __packaged_task__ 的结 果,并位于进行等待的线程中。 +这些可以分别通过使用 __promise__ 或 __packaged_task__ 的 `set_wait_callback()` 成员函数来设置。

This allows ['lazy futures] where the result is not actually computed until it is needed by some thread. In the example below, the call to `f.get()` invokes the callback `invoke_lazy_task`, which runs the task to set the value. If you remove the call to
-`f.get()`, the task is not ever run.
+`f.get()`, the task is not ever run.\n
+这样就可以支持['延迟的期货],即在结果真的被某个线程需要时才进行真正的计算。 在以下例子中,对 `f.get()` 的调用会执行回调函数 +`invoke_lazy_task`,后者运行某个任务以设置结果值。如果你删除对 `f.get()` 的 调用,该任务将不会被运行。

     int calculate_the_answer_to_life_the_universe_and_everything()
     {
=======================================
--- /trunk/libs/thread/doc/mutex_concepts.qbk   Mon Dec 28 23:05:14 2009
+++ /trunk/libs/thread/doc/mutex_concepts.qbk   Sun Feb  7 05:34:27 2010
@@ -5,38 +5,48 @@
   http://www.boost.org/LICENSE_1_0.txt).
 ]

-[section:mutex_concepts Mutex Concepts]
+[section:mutex_concepts Mutex Concepts 互斥量概念]

A mutex object facilitates protection against data races and allows thread-safe synchronization of data between threads. A thread obtains ownership of a mutex object by calling one of the lock functions and relinquishes ownership by calling the corresponding unlock function. Mutexes may be either recursive or non-recursive, and may grant simultaneous ownership to one or many threads. __boost_thread__ supplies recursive and non-recursive mutexes with exclusive ownership semantics, along with a shared
-ownership (multiple-reader / single-writer) mutex.
+ownership (multiple-reader / single-writer) mutex.\n
+互斥量对象简化了线程间数据竟态保护和数据同步。一个线程通过一个锁定函数取得 一个互斥量的所有权,通过一个对应的解锁函数释放所有权。 +互斥量可以是支持递归所有权的或非递归所有权的,也可以同时属于多个线程。 __boost_thread__ 库提供递归和非递归互斥量,
+支持排他型的所有权和共享所有权(多读/单写)。

__boost_thread__ supports four basic concepts for lockable objects: __lockable_concept_type__, __timed_lockable_concept_type__, __shared_lockable_concept_type__ and __upgrade_lockable_concept_type__. Each mutex type implements one or more of these concepts, as
-do the various lock types.
-
-[section:lockable `Lockable` Concept]
+do the various lock types.\n
+__boost_thread__ 库支持四种基本的可所有权概念: __lockable_concept_type__, __timed_lockable_concept_type__, +__shared_lockable_concept_type__ 和 __upgrade_lockable_concept_type__。每种 互斥量依据自己的目标实现一种或多种概念。
+
+[section:lockable `Lockable` Concept  `Lockable`概念]

The __lockable_concept__ models exclusive ownership. A type that implements the __lockable_concept__ shall provide the following
-member functions:
+member functions:\n
+__lockable_concept__ 对排他型所有权建模。实现 __lockable_concept__ 需要提供 下面的成员函数:

 * [lock_ref_link `void lock();`]
 * [try_lock_ref_link `bool try_lock();`]
 * [unlock_ref_link `void unlock();`]

-Lock ownership acquired through a call to __lock_ref__ or __try_lock_ref__ must be released through a call to __unlock_ref__. +Lock ownership acquired through a call to __lock_ref__ or __try_lock_ref__ must be released through a call to __unlock_ref__.\n +通过 函数 __lock_ref__ 或函数 __try_lock_ref__ 获取的所有权需要通过 __unlock_ref__ 来释放。

 [section:lock `void lock()`]

 [variablelist

-[[Effects:] [The current thread blocks until ownership can be obtained for the current thread.]]
-
-[[Postcondition:] [The current thread owns `*this`.]]
-
-[[Throws:] [__thread_resource_error__ if an error occurs.]]
+[[Effects:] [The current thread blocks until ownership can be obtained for the current thread.\n
+当前线程阻塞直到取得互斥量的所有权。]]
+
+[[Postcondition:] [The current thread owns `*this`.\n
+`*this` 线程拥有该互斥量。]]
+
+[[Throws:] [__thread_resource_error__ if an error occurs.\n
+如果出错抛出 __thread_resource_error__ 异常。]]

 ]
 [endsect]
@@ -45,13 +55,17 @@

 [variablelist

-[[Effects:] [Attempt to obtain ownership for the current thread without blocking.]]
-
-[[Returns:] [`true` if ownership was obtained for the current thread, `false` otherwise.]]
-
-[[Postcondition:] [If the call returns `true`, the current thread owns the `*this`.]]
-
-[[Throws:] [__thread_resource_error__ if an error occurs.]]
+[[Effects:] [Attempt to obtain ownership for the current thread without blocking.\n
+尝试取得互斥量所有权,线程不会被阻塞。]]
+
+[[Returns:] [`true` if ownership was obtained for the current thread, `false` otherwise.\n
+如果取得所有权返回 `true`, 否则返回 `false`。]]
+
+[[Postcondition:] [If the call returns `true`, the current thread owns the `*this`.\n
+如果返回 `true`, 当前线程拥有 `*this`。 ]]
+
+[[Throws:] [__thread_resource_error__ if an error occurs.\n
+如果出错抛出 __thread_resource_error__ 异常。]]

 ]
 [endsect]
@@ -60,43 +74,55 @@

 [variablelist

-[[Precondition:] [The current thread owns `*this`.]]
-
-[[Effects:] [Releases ownership by the current thread.]]
-
-[[Postcondition:] [The current thread no longer owns `*this`.]]
-
-[[Throws:] [Nothing]]
+[[Precondition:] [The current thread owns `*this`.\n
+当前线程拥有 `*this`。]]
+
+[[Effects:] [Releases ownership by the current thread.\n
+当前线程释放互斥量所有权。]]
+
+[[Postcondition:] [The current thread no longer owns `*this`.\n
+当前线程拥不拥有 `*this`。]]
+
+[[Throws:] [Nothing\n
+无]]
 ]
 [endsect]
 [endsect]

-[section:timed_lockable `TimedLockable` Concept]
+[section:timed_lockable `TimedLockable` Concept  `TimedLockable`概念]

The __timed_lockable_concept__ refines the __lockable_concept__ to add support for
-timeouts when trying to acquire the lock.
+timeouts when trying to acquire the lock.\n
+__timed_lockable_concept__ 细化了 __lockable_concept__,支持尝试获取所有权 时超时放弃。

A type that implements the __timed_lockable_concept__ shall meet the requirements of the __lockable_concept__. In addition, the following member functions must be
-provided:
+provided:\n
+实现 __timed_lockable_concept__ 的类型需要符合 __lockable_concept__ 的要 求。除此以外,还需要提供下面的成员函数:

* [timed_lock_ref_link `bool timed_lock(boost::system_time const& abs_time);`] * [timed_lock_duration_ref_link `template<typename DurationType> bool timed_lock(DurationType const& rel_time);`]

-Lock ownership acquired through a call to __timed_lock_ref__ must be released through a call to __unlock_ref__. +Lock ownership acquired through a call to __timed_lock_ref__ must be released through a call to __unlock_ref__.\n
+通过 __timed_lock_ref__ 获取的所有权需要通过 __unlock_ref__ 来释放。

 [section:timed_lock `bool timed_lock(boost::system_time const& abs_time)`]

 [variablelist

[[Effects:] [Attempt to obtain ownership for the current thread. Blocks until ownership can be obtained, or the specified time is -reached. If the specified time has already passed, behaves as __try_lock_ref__.]]
-
-[[Returns:] [`true` if ownership was obtained for the current thread, `false` otherwise.]]
-
-[[Postcondition:] [If the call returns `true`, the current thread owns `*this`.]]
-
-[[Throws:] [__thread_resource_error__ if an error occurs.]]
+reached. If the specified time has already passed, behaves as __try_lock_ref__.\n +当前线程尝试取得该互斥量所有权。线程阻塞直到它获得所有权, 或等待超过指定的 时间点。如果等待时间点已过,
+函数的行为和 __try_lock_ref__ 一样。]]
+
+[[Returns:] [`true` if ownership was obtained for the current thread, `false` otherwise.\n
+如果取得所有权返回 `true`, 否则返回 `false`。]]
+
+[[Postcondition:] [If the call returns `true`, the current thread owns `*this`.\n
+如果返回 `true`, 当前线程拥有 `*this`。]]
+
+[[Throws:] [__thread_resource_error__ if an error occurs.\n
+如果出错抛出 __thread_resource_error__ 异常。]]
 ]
 [endsect]

@@ -106,25 +132,30 @@
 [variablelist

 [[Effects:] [As-if [timed_lock_ref_link
-`timed_lock(boost::get_system_time()+rel_time)`].]]
+`timed_lock(boost::get_system_time()+rel_time)`].\n
+同 [timed_lock_ref_link `timed_lock(boost::get_system_time()+rel_time)`]。 ]]

 ]
 [endsect]

 [endsect]

-[section:shared_lockable `SharedLockable` Concept]
+[section:shared_lockable `SharedLockable` Concept  `SharedLockable`概念]

The __shared_lockable_concept__ is a refinement of the __timed_lockable_concept__ that allows for ['shared ownership] as well as ['exclusive ownership]. This is the
 standard multiple-reader / single-write model: at most one thread can have
exclusive ownership, and if any thread does have exclusive ownership, no other threads can have shared or exclusive ownership. Alternatively, many threads may have
-shared ownership.
+shared ownership.\n
+__shared_lockable_concept__ 细化了 __timed_lockable_concept__ 允许['共享所 有权]和['排他型所有权]。 +适用于标准的"多读/单写"模型: 最多一个线程可以获取排他型所有权, 如果任一线程 获得排他型所有权, +则其他线程不能获取到排他型所有权和共享型所有权。相反的, 多个线程可以同时获 得共享所有权。

For a type to implement the __shared_lockable_concept__, as well as meeting the requirements of the __timed_lockable_concept__, it must also provide the following
-member functions:
+member functions:\n
+如果一个类型要实现 __shared_lockable_concept__, 除了需要满足 __timed_lockable_concept__ 的要求, 还需要提供下面的成员函数:

 * [lock_shared_ref_link `void lock_shared();`]
 * [try_lock_shared_ref_link `bool try_lock_shared();`]
@@ -132,17 +163,21 @@
* [timed_lock_shared_ref_link `bool timed_lock_shared(boost::system_time const& abs_time);`]

Lock ownership acquired through a call to __lock_shared_ref__, __try_lock_shared_ref__ or __timed_lock_shared_ref__ must be released
-through a call to __unlock_shared_ref__.
+through a call to __unlock_shared_ref__.\n
+通过 __lock_shared_ref__, __try_lock_shared_ref__ 或 __timed_lock_shared_ref__ 获取的所有权需要通过 __unlock_shared_ref__ 来释 放。

 [section:lock_shared `void lock_shared()`]

 [variablelist

-[[Effects:] [The current thread blocks until shared ownership can be obtained for the current thread.]]
-
-[[Postcondition:] [The current thread has shared ownership of `*this`.]]
-
-[[Throws:] [__thread_resource_error__ if an error occurs.]]
+[[Effects:] [The current thread blocks until shared ownership can be obtained for the current thread.\n
+当前线程阻塞直到取得互斥量的共享所有权。]]
+
+[[Postcondition:] [The current thread has shared ownership of `*this`.\n
+当前线程取得 `*this` 的共享所有权。]]
+
+[[Throws:] [__thread_resource_error__ if an error occurs.\n
+如果出错抛出 __thread_resource_error__ 异常。]]

 ]
 [endsect]
@@ -151,13 +186,17 @@

 [variablelist

-[[Effects:] [Attempt to obtain shared ownership for the current thread without blocking.]]
-
-[[Returns:] [`true` if shared ownership was obtained for the current thread, `false` otherwise.]]
-
-[[Postcondition:] [If the call returns `true`, the current thread has shared ownership of `*this`.]]
-
-[[Throws:] [__thread_resource_error__ if an error occurs.]]
+[[Effects:] [Attempt to obtain shared ownership for the current thread without blocking.\n
+当前线程尝试取得该互斥量的共享所有权,线程不阻塞。]]
+
+[[Returns:] [`true` if shared ownership was obtained for the current thread, `false` otherwise.\n
+如果取得互斥量的共享所有权返回 `true`, 否则返回 `false`。]]
+
+[[Postcondition:] [If the call returns `true`, the current thread has shared ownership of `*this`.\n
+如果返回 `true`,  当前线程取得 `*this` 的共享所有权。]]
+
+[[Throws:] [__thread_resource_error__ if an error occurs.\n
+如果出错抛出 __thread_resource_error__ 异常。]]

 ]
 [endsect]
@@ -167,14 +206,19 @@
 [variablelist

[[Effects:] [Attempt to obtain shared ownership for the current thread. Blocks until shared ownership can be obtained, or the -specified time is reached. If the specified time has already passed, behaves as __try_lock_shared_ref__.]]
-
-[[Returns:] [`true` if shared ownership was acquired for the current thread, `false` otherwise.]] +specified time is reached. If the specified time has already passed, behaves as __try_lock_shared_ref__.\n +当前线程尝试取得该互斥量的共享所有权。线程阻塞直到它获得所有权, 或等待超过 指定的时间点。如果等待时间点已过,
+函数的行为和 __try_lock_shared_ref__ 一样。]]
+
+[[Returns:] [`true` if shared ownership was acquired for the current thread, `false` otherwise.\n
+如果取得互斥量的共享所有权返回 `true`, 否则返回 `false`。]]

[[Postcondition:] [If the call returns `true`, the current thread has shared
-ownership of `*this`.]]
-
-[[Throws:] [__thread_resource_error__ if an error occurs.]]
+ownership of `*this`.\n
+如果返回 `true`, 当前线程取得互斥量的共享所有权。]]
+
+[[Throws:] [__thread_resource_error__ if an error occurs.\n
+如果出错抛出 __thread_resource_error__ 异常。]]

 ]
 [endsect]
@@ -183,13 +227,17 @@

 [variablelist

-[[Precondition:] [The current thread has shared ownership of `*this`.]]
-
-[[Effects:] [Releases shared ownership of `*this` by the current thread.]]
-
-[[Postcondition:] [The current thread no longer has shared ownership of `*this`.]]
-
-[[Throws:] [Nothing]]
+[[Precondition:] [The current thread has shared ownership of `*this`.\n
+当前线程拥有 `*this` 的共享所有权。]]
+
+[[Effects:] [Releases shared ownership of `*this` by the current thread.\n
+释放当前线程拥有的 `*this` 共享所有权。]]
+
+[[Postcondition:] [The current thread no longer has shared ownership of `*this`.\n
+当前线程不在拥有 `*this` 的共享所有权。]]
+
+[[Throws:] [Nothing\n
+无]]

 ]
 [endsect]
@@ -197,25 +245,32 @@

 [endsect]

-[section:upgrade_lockable `UpgradeLockable` Concept]
+[section:upgrade_lockable `UpgradeLockable` Concept  `UpgradeLockable`概念]

The __upgrade_lockable_concept__ is a refinement of the __shared_lockable_concept__ that allows for ['upgradable ownership] as well as ['shared ownership] and ['exclusive ownership]. This is an extension to the multiple-reader / single-write model provided by the __shared_lockable_concept__: a single thread may have ['upgradable ownership] at the same time as others have ['shared ownership]. The thread with ['upgradable ownership] may at any time attempt to upgrade that ownership to ['exclusive ownership]. If no other threads have shared ownership, the upgrade is completed immediately, and the thread now has ['exclusive ownership], which -must be relinquished by a call to __unlock_ref__, just as if it had been acquired by a call to __lock_ref__. +must be relinquished by a call to __unlock_ref__, just as if it had been acquired by a call to __lock_ref__.\n +__upgrade_lockable_concept__ 是 __shared_lockable_concept__ 的细化,特点在 于允许['可升级所有权],和['共享所有权]和['排他型所有权]一样。 +这是对 __shared_lockable_concept__ 所提供的"多读/单写"模型的一个扩展:一个 线程可以拥有['可升级所有权]而同时其他线程拥有['共享所有权]。 +带有['可升级所有权]的线程可以在任何时候试图升级其所有权为['排他型所有权]。 如果此时没有其他线程拥有共享所有权,升级立即完成, +该线程就会拥有['排他型所有权], 这个所有权需要通过 __unlock_ref__ 来释放, 就 像这个所有权是通过 __lock_ref__ 取得一样。

If a thread with ['upgradable ownership] tries to upgrade whilst other threads have ['shared ownership], the attempt will fail and
-the thread will block until ['exclusive ownership] can be acquired.
+the thread will block until ['exclusive ownership] can be acquired.\n
+如果一个带有['可升级所有权]线程试图升级而其他线程拥有['共享所有权], 升级会 失败,该线程阻塞直到其获得['排他型所有权]。

Ownership can also be ['downgraded] as well as ['upgraded]: exclusive ownership of an implementation of the __upgrade_lockable_concept__ can be downgraded to upgradable ownership or shared ownership, and upgradable ownership can be
-downgraded to plain shared ownership.
+downgraded to plain shared ownership.\n
+和['升级]一样,所有权也可以['降级]: __upgrade_lockable_concept__ 实现的独占 式所有权可以降级为可升级所有权或者共享所有权, 而可升级所有权可以降级为一般共 享所有权。

For a type to implement the __upgrade_lockable_concept__, as well as meeting the requirements of the __shared_lockable_concept__, it must also provide the following
-member functions:
+member functions:\n
+如果一个类型要实现 __upgrade_lockable_concept__,除了需要符合 __shared_lockable_concept__ 的要求之外, 它还需要提供下面的成员函数:

 * [lock_upgrade_ref_link `void lock_upgrade();`]
 * [unlock_upgrade_ref_link `bool unlock_upgrade();`]
@@ -225,18 +280,22 @@

Lock ownership acquired through a call to __lock_upgrade_ref__ must be released through a call to __unlock_upgrade_ref__. If the ownership type is changed through a call to one of the `unlock_xxx_and_lock_yyy()` functions, ownership must be released through a
-call to the unlock function corresponding to the new level of ownership.
-
+call to the unlock function corresponding to the new level of ownership.\n
+通过 __lock_upgrade_ref__ 取得的所有权需要通过函数 __unlock_upgrade_ref__ 来释放。如果所有权类型通过某一个 `unlock_xxx_and_lock_yyy()`
+函数改变的, 则所有权必须通过新所有权对应的释放函数来释放。

 [section:lock_upgrade `void lock_upgrade()`]

 [variablelist

-[[Effects:] [The current thread blocks until upgrade ownership can be obtained for the current thread.]]
-
-[[Postcondition:] [The current thread has upgrade ownership of `*this`.]]
-
-[[Throws:] [__thread_resource_error__ if an error occurs.]]
+[[Effects:] [The current thread blocks until upgrade ownership can be obtained for the current thread.\n
+当前线程阻塞知道它获得可升级所有权。]]
+
+[[Postcondition:] [The current thread has upgrade ownership of `*this`.\n
+当前线程取得 `*this` 的可升级所有权。]]
+
+[[Throws:] [__thread_resource_error__ if an error occurs.\n
+如果出错抛出 __thread_resource_error__ 异常。]]

 ]
 [endsect]
@@ -245,13 +304,17 @@

 [variablelist

-[[Precondition:] [The current thread has upgrade ownership of `*this`.]]
-
-[[Effects:] [Releases upgrade ownership of `*this` by the current thread.]]
-
-[[Postcondition:] [The current thread no longer has upgrade ownership of `*this`.]]
-
-[[Throws:] [Nothing]]
+[[Precondition:] [The current thread has upgrade ownership of `*this`.\n
+当前线程拥有 `*this` 的可升级所有权。]]
+
+[[Effects:] [Releases upgrade ownership of `*this` by the current thread.\n
+释放当前线程拥有的 `*this` 的可升级所有权。]]
+
+[[Postcondition:] [The current thread no longer has upgrade ownership of `*this`.\n
+当前线程不在拥有 `*this` 的可升级所有权。]]
+
+[[Throws:] [Nothing\n
+无]]

 ]
 [endsect]
@@ -260,14 +323,19 @@

 [variablelist

-[[Precondition:] [The current thread has upgrade ownership of `*this`.]]
+[[Precondition:] [The current thread has upgrade ownership of `*this`.\n
+当前线程拥有 `*this` 的可升级所有权。]]

[[Effects:] [Atomically releases upgrade ownership of `*this` by the current thread and acquires exclusive ownership of `*this`. If -any other threads have shared ownership, blocks until exclusive ownership can be acquired.]]
-
-[[Postcondition:] [The current thread has exclusive ownership of `*this`.]]
-
-[[Throws:] [Nothing]]
+any other threads have shared ownership, blocks until exclusive ownership can be acquired.\n +当前线程自动释放拥有的 `*this` 可升级所有权,并试图取得 `*this` 的独占所有 权。如果其它线程拥有共享所有权,
+则线程阻塞直到其获得独占所有权。]]
+
+[[Postcondition:] [The current thread has exclusive ownership of `*this`.\n
+当前线程拥有 `*this` 的独占所有权。]]
+
+[[Throws:] [Nothing\n
+无]]

 ]
 [endsect]
@@ -276,14 +344,18 @@

 [variablelist

-[[Precondition:] [The current thread has upgrade ownership of `*this`.]]
+[[Precondition:] [The current thread has upgrade ownership of `*this`.\n
+当前线程拥有 `*this` 的可升级所有权。]]

[[Effects:] [Atomically releases upgrade ownership of `*this` by the current thread and acquires shared ownership of `*this` without
-blocking.]]
-
-[[Postcondition:] [The current thread has shared ownership of `*this`.]]
-
-[[Throws:] [Nothing]]
+blocking.\n
+当前线程自动释放拥有的 `*this` 可升级所有权,取得 `*this` 共享所有权,该函 数会立即返回。]]
+
+[[Postcondition:] [The current thread has shared ownership of `*this`.\n
+当前线程拥有 `*this` 的共享所有权。]]
+
+[[Throws:] [Nothing\n
+无]]

 ]
 [endsect]
@@ -292,14 +364,18 @@

 [variablelist

-[[Precondition:] [The current thread has exclusive ownership of `*this`.]]
+[[Precondition:] [The current thread has exclusive ownership of `*this`.\n
+当前线程拥有 `*this` 的独占所有权。]]

[[Effects:] [Atomically releases exclusive ownership of `*this` by the current thread and acquires upgrade ownership of `*this`
-without blocking.]]
-
-[[Postcondition:] [The current thread has upgrade ownership of `*this`.]]
-
-[[Throws:] [Nothing]]
+without blocking.\n
+当前线程自动释放拥有的 `*this` 独占级所有权,取得 `*this` 的可升级所有 权,该函数会立即返回。]]
+
+[[Postcondition:] [The current thread has upgrade ownership of `*this`.\n
+当前线程自动拥有 `*this` 可升级所有权。]]
+
+[[Throws:] [Nothing\n
+无]]

 ]
 [endsect]
@@ -308,7 +384,7 @@

 [endsect]

-[section:locks Lock Types]
+[section:locks Lock Types 锁定类型]

 [section:lock_guard Class template `lock_guard`]

@@ -331,15 +407,21 @@
 locking and unlocking. In addition, the [link
thread.synchronization.locks.lock_guard.constructor_adopt `lock_guard(Lockable &
 m,boost::adopt_lock_t)` constructor] allows the __lock_guard__ object to
-take ownership of a lock already held by the current thread.
+take ownership of a lock already held by the current thread.\n
+__lock_guard__ 非常简单: 构造函数传入一个 __lockable_concept__ 对象,构造函 数取得该对象的所有权。析构时释放所有权。 +这样为 __lockable_concept_type__ 对象提供了一个 RAII 风格的外观, 方便实现异 常安全的锁定和解锁。 +额外的, [link thread.synchronization.locks.lock_guard.constructor_adopt `lock_guard(Lockable &m,boost::adopt_lock_t)` 构造函数]
+允许 __lock_guard__ 对象取得当前线程已拥有锁定的所有权。

 [section:constructor `lock_guard(Lockable & m)`]

 [variablelist

-[[Effects:] [Stores a reference to `m`. Invokes [lock_ref_link `m.lock()`].]]
-
-[[Throws:] [Any exception thrown by the call to [lock_ref_link `m.lock()`].]] +[[Effects:] [Stores a reference to `m`. Invokes [lock_ref_link `m.lock()`].\n
+存储对 `m` 的引用,调用 [lock_ref_link `m.lock()`]。]]
+
+[[Throws:] [Any exception thrown by the call to [lock_ref_link `m.lock()`].\n
+调用 [lock_ref_link `m.lock()`] 可能抛出的异常。]]

 ]

@@ -350,12 +432,15 @@
 [variablelist

 [[Precondition:] [The current thread owns a lock on `m` equivalent to one
-obtained by a call to [lock_ref_link `m.lock()`].]]
+obtained by a call to [lock_ref_link `m.lock()`].\n
+当前线程拥有 `m` 的所有权, 等同于函数 [lock_ref_link `m.lock()`] 调用所获得 的。]]

[[Effects:] [Stores a reference to `m`. Takes ownership of the lock state of
-`m`.]]
-
-[[Throws:] [Nothing.]]
+`m`.\n
+存储对 `m` 的引用,接管 `m` 的锁定状态的所有权。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -366,9 +451,11 @@
 [variablelist

[[Effects:] [Invokes [unlock_ref_link `m.unlock()`] on the __lockable_concept_type__
-object passed to the constructor.]]
-
-[[Throws:] [Nothing.]]
+object passed to the constructor.\n
+调用传入至构造函数的 __lockable_concept_type__ 对象的 [unlock_ref_link `m.unlock()`]。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -424,29 +511,42 @@
__unique_lock__ is more complex than __lock_guard__: not only does it provide for RAII-style locking, it also allows for deferring acquiring the lock until the __lock_ref__ member function is called explicitly, or trying to acquire the lock in a non-blocking fashion, or with a timeout. Consequently, __unlock_ref__ is only called in the destructor if the lock object has locked the -__lockable_concept_type__ object, or otherwise adopted a lock on the __lockable_concept_type__ object. +__lockable_concept_type__ object, or otherwise adopted a lock on the __lockable_concept_type__ object.\n +__unique_lock__ 比 __lock_guard__ 复杂许多: 不仅提供RAII风格的外观, 它还允 许推迟获得锁定, 直到 __lock_ref__ 函数显式调用, +或者试图以非阻塞方式或超时方式获得锁定。最后, 析构函数在 __lockable_concept_type__ 对象被其锁定的情况下调用 __unlock_ref__ 函数,
+否则取得可锁定对象的一个锁。

Specializations of __unique_lock__ model the __timed_lockable_concept__ if the supplied __lockable_concept_type__ type itself models __timed_lockable_concept__ (e.g. `boost::unique_lock<boost::timed_mutex>`), or the __lockable_concept__ otherwise
-(e.g. `boost::unique_lock<boost::mutex>`).
+(e.g. `boost::unique_lock<boost::mutex>`). \n
+__unique_lock__ 的特化如果提供了实现 __timed_lockable_concept__ 的 __lockable_concept_type__,就实现了 __timed_lockable_concept__ +(如 boost::unique_lock<boost::timed_mutex>), 否则为 __lockable_concept__ (如 boost::unique_lock<boost::mutex>)。

An instance of __unique_lock__ is said to ['own] the lock state of a __lockable_concept_type__ `m` if __mutex_func_ref__ returns a pointer to `m` and __owns_lock_ref__ returns `true`. If an object that ['owns] the lock state of a __lockable_concept_type__ object -is destroyed, then the destructor will invoke [unlock_ref_link `mutex()->unlock()`]. +is destroyed, then the destructor will invoke [unlock_ref_link `mutex()->unlock()`].\n +如果 __mutex_func_ref__ 返回指向的 `m` 的指针并且 __owns_lock_ref__ 返回 `true`,则称该 __unique_lock__ 实例['拥有]一个 +__lockable_concept_type__ 对象 `m` 的锁定状态。如果一个['拥有] __lockable_concept_type__ 对象的锁定状态的对象被销毁,
+其析构函数会调用函数 [unlock_ref_link `mutex()->unlock()`]。

The member functions of __unique_lock__ are not thread-safe. In particular, __unique_lock__ is intended to model the ownership of a __lockable_concept_type__ object by a particular thread, and the member functions that release ownership of the lock state -(including the destructor) must be called by the same thread that acquired ownership of the lock state. +(including the destructor) must be called by the same thread that acquired ownership of the lock state.\n +__unique_lock__ 的成员函数不是线程安全的。特别的, __unique_lock__ 是针对单 一线程对 __lockable_concept_type__ 对象所有权建立模型的,
+这样一个对象的成员函数(包括析构函数)必须在同一个线程内调用。

 [section:defaultconstructor `unique_lock()`]

 [variablelist

-[[Effects:] [Creates a lock object with no associated mutex.]]
-
-[[Postcondition:] [__owns_lock_ref__ returns `false`. __mutex_func_ref__ returns `NULL`.]]
-
-[[Throws:] [Nothing.]]
+[[Effects:] [Creates a lock object with no associated mutex.\n
+创建一个锁对象,没有关联到任何互斥量。]]
+
+[[Postcondition:] [__owns_lock_ref__ returns `false`. __mutex_func_ref__ returns `NULL`.\n
+__owns_lock_ref__ 返回 `false`,__mutex_func_ref__ 返回 `NULL`。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -456,11 +556,14 @@

 [variablelist

-[[Effects:] [Stores a reference to `m`. Invokes [lock_ref_link `m.lock()`].]]
-
-[[Postcondition:] [__owns_lock_ref__ returns `true`. __mutex_func_ref__ returns `&m`.]]
-
-[[Throws:] [Any exception thrown by the call to [lock_ref_link `m.lock()`].]] +[[Effects:] [Stores a reference to `m`. Invokes [lock_ref_link `m.lock()`].\n
+存储 `m` 的引用. 调用 [lock_ref_link `m.lock()`]。 ]]
+
+[[Postcondition:] [__owns_lock_ref__ returns `true`. __mutex_func_ref__ returns `&m`.\n
+__owns_lock_ref__ 返回 `true`,__mutex_func_ref__ 返回 `&m`。]]
+
+[[Throws:] [Any exception thrown by the call to [lock_ref_link `m.lock()`].\n
+调用 [lock_ref_link `m.lock()`] 可能抛出的异常。]]

 ]

@@ -470,13 +573,17 @@

 [variablelist

-[[Precondition:] [The current thread owns an exclusive lock on `m`.]]
-
-[[Effects:] [Stores a reference to `m`. Takes ownership of the lock state of `m`.]]
-
-[[Postcondition:] [__owns_lock_ref__ returns `true`. __mutex_func_ref__ returns `&m`.]]
-
-[[Throws:] [Nothing.]]
+[[Precondition:] [The current thread owns an exclusive lock on `m`.\n
+当前线程拥有对 `m` 的独占锁。]]
+
+[[Effects:] [Stores a reference to `m`. Takes ownership of the lock state of `m`.\n
+存储 `m` 的引用。接管 `m` 的所有权。]]
+
+[[Postcondition:] [__owns_lock_ref__ returns `true`. __mutex_func_ref__ returns `&m`.\n
+__owns_lock_ref__ 返回 `true`。__mutex_func_ref__ 返回 `&m`。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -486,11 +593,14 @@

 [variablelist

-[[Effects:] [Stores a reference to `m`.]]
-
-[[Postcondition:] [__owns_lock_ref__ returns `false`. __mutex_func_ref__ returns `&m`.]]
-
-[[Throws:] [Nothing.]]
+[[Effects:] [Stores a reference to `m`.\n
+存储 `m` 的引用。]]
+
+[[Postcondition:] [__owns_lock_ref__ returns `false`. __mutex_func_ref__ returns `&m`.\n
+__owns_lock_ref__ 返回 `false`。__mutex_func_ref__ 返回 `&m`。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -502,13 +612,17 @@

 [[Effects:] [Stores a reference to `m`. Invokes [try_lock_ref_link
 `m.try_lock()`], and takes ownership of the lock state if the call returns
-`true`.]]
+`true`.\n
+存储 `m` 的引用. 调用 [try_lock_ref_link `m.try_lock()`], 如果调回返回 `true` 则接管锁状态的所有权。]]

[[Postcondition:] [__mutex_func_ref__ returns `&m`. If the call to __try_lock_ref__ returned `true`, then __owns_lock_ref__ returns `true`, otherwise __owns_lock_ref__
-returns `false`.]]
-
-[[Throws:] [Nothing.]]
+returns `false`.\n
+__mutex_func_ref__ 返回 `&m`。如果对 __try_lock_ref__ 的调用返回 `true`, 那 么 __owns_lock_ref__ 返回 `true`,
+否则 __owns_lock_ref__ 返回 `false`。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -520,13 +634,17 @@

 [[Effects:] [Stores a reference to `m`. Invokes [timed_lock_ref_link
`m.timed_lock(abs_time)`], and takes ownership of the lock state if the call
-returns `true`.]]
+returns `true`.\n
+存储 `m` 的引用。调用 [timed_lock_ref_link `m.timed_lock(abs_time)`], 如果 调回返回 `true` 则接管锁状态的所有权。]]

[[Postcondition:] [__mutex_func_ref__ returns `&m`. If the call to __timed_lock_ref__ returned `true`, then __owns_lock_ref__ returns `true`, otherwise __owns_lock_ref__
-returns `false`.]]
-
-[[Throws:] [Any exceptions thrown by the call to [timed_lock_ref_link `m.timed_lock(abs_time)`].]]
+returns `false`.\n
+__mutex_func_ref__ 返回 `&m`。如果调用 __timed_lock_ref__ 返回 `true`, 那 么 __owns_lock_ref__ 返回 `true`,
+否则 __owns_lock_ref__ 返回 `false`。]]
+
+[[Throws:] [Any exceptions thrown by the call to [timed_lock_ref_link `m.timed_lock(abs_time)`].\n
+调用 [timed_lock_ref_link `m.timed_lock(abs_time)`] 可能抛出的异常。]]

 ]

@@ -537,9 +655,11 @@
 [variablelist

 [[Effects:] [Invokes __mutex_func_ref__`->`[unlock_ref_link `unlock()`] if
-__owns_lock_ref__ returns `true`.]]
-
-[[Throws:] [Nothing.]]
+__owns_lock_ref__ returns `true`.\n
+如果 __owns_lock_ref__ 返回 `true`,调用 __mutex_func_ref__->[unlock_ref_link `unlock()`]。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -550,9 +670,11 @@
 [variablelist

[[Returns:] [`true` if the `*this` owns the lock on the __lockable_concept_type__
-object associated with `*this`.]]
-
-[[Throws:] [Nothing.]]
+object associated with `*this`.\n
+如果 `*this` 拥有其关联 __lockable_concept_type__ 对象的锁定,返回 `true`。 ]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -563,9 +685,11 @@
 [variablelist

[[Returns:] [A pointer to the __lockable_concept_type__ object associated with
-`*this`, or `NULL` if there is no such object.]]
-
-[[Throws:] [Nothing.]]
+`*this`, or `NULL` if there is no such object.\n
+返回 `*this` 关联的 __lockable_concept_type__ 对象指针, 如果没有返回 `NULL`。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -577,9 +701,11 @@

[[Returns:] [If __owns_lock_ref__ would return `true`, a value that evaluates to
 `true` in boolean contexts, otherwise a value that evaluates to `false` in
-boolean contexts.]]
-
-[[Throws:] [Nothing.]]
+boolean contexts.\n
+如果 __owns_lock_ref__ 返回 `true`, 该操作符返回逻辑上的 `true`, 否则为 `false`。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -591,7 +717,8 @@

 [[Returns:] [`!` __owns_lock_ref__.]]

-[[Throws:] [Nothing.]]
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -603,15 +730,20 @@

[[Effects:] [The association between `*this` and the __lockable_concept_type__ object is removed, without affecting the lock state of the __lockable_concept_type__ object. If __owns_lock_ref__ would have returned `true`, it is the responsibility of the calling
-code to ensure that the __lockable_concept_type__ is correctly unlocked.]]
+code to ensure that the __lockable_concept_type__ is correctly unlocked.\n
+移除 `*this` 和 __lockable_concept_type__ 对象的关联, 不改变 __lockable_concept_type__ 对象的锁定状态。 +如果在这个函数调用前 __owns_lock_ref__ 返回 `true`, 后续代码需要保证 __lockable_concept_type__ 对象被正确解锁。]]

[[Returns:] [A pointer to the __lockable_concept_type__ object associated with `*this` at the point of the call, or `NULL` if there
-is no such object.]]
-
-[[Throws:] [Nothing.]]
+is no such object.\n
+`*this` 关联的 __lockable_concept_type__ 对象指针, 如果没有关联,则为 `NULL`。]]
+
+[[Throws:] [Nothing.\n
+无]]

[[Postcondition:] [`*this` is no longer associated with any __lockable_concept_type__ object. __mutex_func_ref__ returns `NULL` and
-__owns_lock_ref__ returns `false`.]]
+__owns_lock_ref__ returns `false`.\n
+`*this` 不再和 __lockable_concept_type__ 对象关联。__mutex_func_ref__ 返回 `NULL` 并且 __owns_lock_ref__ 返回 `false`。]]

 ]

@@ -658,30 +790,44 @@
     };

Like __unique_lock__, __shared_lock__ models the __lockable_concept__, but rather than acquiring unique ownership of the supplied -__lockable_concept_type__ object, locking an instance of __shared_lock__ acquires shared ownership. +__lockable_concept_type__ object, locking an instance of __shared_lock__ acquires shared ownership.\n +和 __unique_lock__ 一样, __shared_lock__ 对 __lockable_concept__ 建模, 但是 不仅支持 __lockable_concept_type__ 对象的唯一所有权获取,
+还支持 __shared_lock__ 的共享所有权获取。

Like __unique_lock__, not only does it provide for RAII-style locking, it also allows for deferring acquiring the lock until the __lock_ref__ member function is called explicitly, or trying to acquire the lock in a non-blocking fashion, or with a timeout. Consequently, __unlock_ref__ is only called in the destructor if the lock object has locked the __lockable_concept_type__ -object, or otherwise adopted a lock on the __lockable_concept_type__ object. +object, or otherwise adopted a lock on the __lockable_concept_type__ object.\n +和 __unique_lock__ 一样,不仅提供RAII风格的外观, 它也允许推迟获得锁定, 直 到 __lock_ref__ 函数被显式调用, 或者支持非阻塞方式获得锁定, +或者是支持超时锁定。最后, 析构函数在 __lockable_concept_type__ 对象被其锁定 的情况下调用 __unlock_ref__ 函数,
+否则取得 __lockable_concept_type__ 对象上的一个锁。

An instance of __shared_lock__ is said to ['own] the lock state of a __lockable_concept_type__ `m` if __mutex_func_ref__ returns a pointer to `m` and __owns_lock_ref__ returns `true`. If an object that ['owns] the lock state of a __lockable_concept_type__ object -is destroyed, then the destructor will invoke [unlock_shared_ref_link `mutex()->unlock_shared()`]. +is destroyed, then the destructor will invoke [unlock_shared_ref_link `mutex()->unlock_shared()`].\n +如果函数 __mutex_func_ref__ 返回指向 `m` 的指针并且 __owns_lock_ref__ 返回 `true`,就说该 __shared_lock__ 实例['拥有]一个 +__lockable_concept_type__ 对象的锁定状态。如果一个['拥有] __lockable_concept_type__ 对象的锁定状态的实例被销毁,
+则析构函数会调用 [unlock_shared_ref_link `mutex()->unlock_shared()`]。

The member functions of __shared_lock__ are not thread-safe. In particular, __shared_lock__ is intended to model the shared ownership of a __lockable_concept_type__ object by a particular thread, and the member functions that release ownership of the lock -state (including the destructor) must be called by the same thread that acquired ownership of the lock state. +state (including the destructor) must be called by the same thread that acquired ownership of the lock state.\n +__shared_lock__ 的成员函数不是线程安全的。特别的, __shared_lock__ 是针对单 一线程对 __lockable_concept_type__ 对象所有权建立模型的,
+这样一个对象的成员函数(包含构造析构函数)必须在同一个线程内调用。
+

 [section:defaultconstructor `shared_lock()`]

 [variablelist

-[[Effects:] [Creates a lock object with no associated mutex.]]
-
-[[Postcondition:] [__owns_lock_ref__ returns `false`. __mutex_func_ref__ returns `NULL`.]]
-
-[[Throws:] [Nothing.]]
+[[Effects:] [Creates a lock object with no associated mutex.\n
+创建一个不关联到任何互斥量的锁定对象。]]
+
+[[Postcondition:] [__owns_lock_ref__ returns `false`. __mutex_func_ref__ returns `NULL`.\n
+__owns_lock_ref__ 返回 `false`. __mutex_func_ref__ 返回 `NULL`。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -691,11 +837,14 @@

 [variablelist

-[[Effects:] [Stores a reference to `m`. Invokes [lock_shared_ref_link `m.lock_shared()`].]]
-
-[[Postcondition:] [__owns_lock_shared_ref__ returns `true`. __mutex_func_ref__ returns `&m`.]]
-
-[[Throws:] [Any exception thrown by the call to [lock_shared_ref_link `m.lock_shared()`].]] +[[Effects:] [Stores a reference to `m`. Invokes [lock_shared_ref_link `m.lock_shared()`].\n
+存储 `m` 的引用,并调用 [lock_shared_ref_link `m.lock_shared()`]。 ]]
+
+[[Postcondition:] [__owns_lock_shared_ref__ returns `true`. __mutex_func_ref__ returns `&m`.\n
+__owns_lock_shared_ref__ 返回 `true`. __mutex_func_ref__ 返回 `&m`。]]
+
+[[Throws:] [Any exception thrown by the call to [lock_shared_ref_link `m.lock_shared()`].\n
+调用 [lock_shared_ref_link `m.lock_shared()`] 可能抛出的异常。]]

 ]

@@ -705,13 +854,17 @@

 [variablelist

-[[Precondition:] [The current thread owns an exclusive lock on `m`.]]
-
-[[Effects:] [Stores a reference to `m`. Takes ownership of the lock state of `m`.]]
-
-[[Postcondition:] [__owns_lock_shared_ref__ returns `true`. __mutex_func_ref__ returns `&m`.]]
-
-[[Throws:] [Nothing.]]
+[[Precondition:] [The current thread owns an exclusive lock on `m`.\n
+当前线程拥有对 `m` 独占锁定。]]
+
+[[Effects:] [Stores a reference to `m`. Takes ownership of the lock state of `m`.\n
+存储 `m` 的引用,接管 `m` 锁定状态。]]
+
+[[Postcondition:] [__owns_lock_shared_ref__ returns `true`. __mutex_func_ref__ returns `&m`.\n
+__owns_lock_shared_ref__ 返回 `true`. __mutex_func_ref__ 返回 `&m`。 ]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -721,11 +874,14 @@

 [variablelist

-[[Effects:] [Stores a reference to `m`.]]
-
-[[Postcondition:] [__owns_lock_shared_ref__ returns `false`. __mutex_func_ref__ returns `&m`.]]
-
-[[Throws:] [Nothing.]]
+[[Effects:] [Stores a reference to `m`.\n
+存储 `m` 的引用。]]
+
+[[Postcondition:] [__owns_lock_shared_ref__ returns `false`. __mutex_func_ref__ returns `&m`.\n
+__owns_lock_shared_ref__ 返回 `false`. __mutex_func_ref__ 返回 `&m`。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -737,13 +893,17 @@

 [[Effects:] [Stores a reference to `m`. Invokes [try_lock_shared_ref_link
`m.try_lock_shared()`], and takes ownership of the lock state if the call returns
-`true`.]]
+`true`.\n
+存储 `m` 的引用,调用 [try_lock_shared_ref_link `m.try_lock_shared()`],如 果调用返回 `true` 则接管锁定状态。]]

[[Postcondition:] [__mutex_func_ref__ returns `&m`. If the call to __try_lock_shared_ref__ returned `true`, then __owns_lock_shared_ref__ returns `true`, otherwise __owns_lock_shared_ref__
-returns `false`.]]
-
-[[Throws:] [Nothing.]]
+returns `false`.\n
+__mutex_func_ref__ 返回 `&m`,如果调用 __try_lock_shared_ref__ 返回 `true`,那么 __owns_lock_shared_ref__ 返回 `true`,
+否则 __owns_lock_shared_ref__ 返回 `false`。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -755,13 +915,17 @@

 [[Effects:] [Stores a reference to `m`. Invokes [timed_lock_shared_ref_link
`m.timed_lock(abs_time)`], and takes ownership of the lock state if the call
-returns `true`.]]
+returns `true`.\n
+存储 `m` 的引用,调用 [timed_lock_shared_ref_link `m.timed_lock(abs_time)`],如果调用返回 `true` 则接管锁定状态。]]

[[Postcondition:] [__mutex_func_ref__ returns `&m`. If the call to __timed_lock_shared_ref__ returned `true`, then __owns_lock_shared_ref__ returns `true`, otherwise __owns_lock_shared_ref__
-returns `false`.]]
-
-[[Throws:] [Any exceptions thrown by the call to [timed_lock_shared_ref_link `m.timed_lock(abs_time)`].]]
+returns `false`.\n
+__mutex_func_ref__ 返回 `&m`. 如果调用 __timed_lock_shared_ref__ 返回 `true`,那么 __owns_lock_shared_ref__ 返回 `true`,
+否则 __owns_lock_shared_ref__ 返回 `false`。]]
+
+[[Throws:] [Any exceptions thrown by the call to [timed_lock_shared_ref_link `m.timed_lock(abs_time)`].\n +调用函数 [timed_lock_shared_ref_link `m.timed_lock(abs_time)`] 可能抛出的异 常。]]

 ]

@@ -772,9 +936,11 @@
 [variablelist

[[Effects:] [Invokes __mutex_func_ref__`->`[unlock_shared_ref_link `unlock_shared()`] if
-__owns_lock_shared_ref__ returns `true`.]]
-
-[[Throws:] [Nothing.]]
+__owns_lock_shared_ref__ returns `true`.\n
+如果 __owns_lock_shared_ref__ 返回 `true` 则调用 __mutex_func_ref__`->`[unlock_shared_ref_link `unlock_shared()`]。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -785,9 +951,11 @@
 [variablelist

[[Returns:] [`true` if the `*this` owns the lock on the __lockable_concept_type__
-object associated with `*this`.]]
-
-[[Throws:] [Nothing.]]
+object associated with `*this`.\n
+如果 `*this` 拥有所关联的 __lockable_concept_type__ 对象的锁定,返回 `true`。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -798,9 +966,11 @@
 [variablelist

[[Returns:] [A pointer to the __lockable_concept_type__ object associated with
-`*this`, or `NULL` if there is no such object.]]
-
-[[Throws:] [Nothing.]]
+`*this`, or `NULL` if there is no such object.\n
+返回 `*this` 关联的 __lockable_concept_type__ 对象指针, 如果没有返回 `NULL`。]]
+
+[[Throws:] [Nothing.\n
***The diff for this file has been truncated for email.***
=======================================
--- /trunk/libs/thread/doc/mutexes.qbk  Mon Dec 28 23:05:14 2009
+++ /trunk/libs/thread/doc/mutexes.qbk  Sun Feb  7 05:34:27 2010
@@ -5,7 +5,7 @@
   http://www.boost.org/LICENSE_1_0.txt).
 ]

-[section:mutex_types Mutex Types]
+[section:mutex_types Mutex Types 互斥量类型]

 [section:mutex Class `mutex`]

@@ -30,7 +30,9 @@
     };

__mutex__ implements the __lockable_concept__ to provide an exclusive-ownership mutex. At most one thread can own the lock on a given -instance of __mutex__ at any time. Multiple concurrent calls to __lock_ref__, __try_lock_ref__ and __unlock_ref__ shall be permitted. +instance of __mutex__ at any time. Multiple concurrent calls to __lock_ref__, __try_lock_ref__ and __unlock_ref__ shall be permitted.\n +__mutex__ 实现了 __lockable_concept__,提供一个独占式的互斥量。对于一个 __mutex__ 实例最多允许一个线程拥有其锁定。
+支持 __lock_ref__, __try_lock_ref__ 和 __unlock_ref__ 的并发调用。

 [section:nativehandle Member function `native_handle()`]

@@ -40,9 +42,12 @@
 [variablelist

[[Effects:] [Returns an instance of `native_handle_type` that can be used with platform-specific APIs to manipulate the underlying -implementation. If no such instance exists, `native_handle()` and `native_handle_type` are not present.]]
-
-[[Throws:] [Nothing.]]
+implementation. If no such instance exists, `native_handle()` and `native_handle_type` are not present.\n +返回一个 `native_handle_type` 实例,可以通过系统平台函数访问该实例。如果平 台上没有这种类型,
+则 `native_handle()` 和 `native_handle_type` 也不会存在。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -57,7 +62,8 @@

     typedef mutex try_mutex;

-__try_mutex__ is a `typedef` to __mutex__, provided for backwards compatibility with previous releases of boost. +__try_mutex__ is a `typedef` to __mutex__, provided for backwards compatibility with previous releases of boost.\n
+__try_mutex__ 是 __mutex__ 的 `typedef`, 用于兼容以前的版本。

 [endsect]

@@ -90,7 +96,10 @@

__timed_mutex__ implements the __timed_lockable_concept__ to provide an exclusive-ownership mutex. At most one thread can own the lock on a given instance of __timed_mutex__ at any time. Multiple concurrent calls to __lock_ref__, __try_lock_ref__, -__timed_lock_ref__, __timed_lock_duration_ref__ and __unlock_ref__ shall be permitted. +__timed_lock_ref__, __timed_lock_duration_ref__ and __unlock_ref__ shall be permitted.\n +__timed_mutex__ 实现了 __timed_lockable_concept__,提供一个独占式的互斥量。 给定一个 __timed_mutex__ 实例, +任何时候最多只允许一个线程拥有其锁定。支持函数 __lock_ref__, __try_lock_ref__, __timed_lock_ref__, __timed_lock_duration_ref__
+和 __unlock_ref__ 并发调用。

 [section:nativehandle Member function `native_handle()`]

@@ -100,9 +109,12 @@
 [variablelist

[[Effects:] [Returns an instance of `native_handle_type` that can be used with platform-specific APIs to manipulate the underlying -implementation. If no such instance exists, `native_handle()` and `native_handle_type` are not present.]]
-
-[[Throws:] [Nothing.]]
+implementation. If no such instance exists, `native_handle()` and `native_handle_type` are not present.\n +返回一个 `native_handle_type` 实例,可以通过系统平台函数访问该实例。如果平 台上没有这种类型,
+则 `native_handle()` 和 `native_handle_type` 也不会存在。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -136,7 +148,10 @@
own the lock on a given instance of __recursive_mutex__ at any time. Multiple concurrent calls to __lock_ref__, __try_lock_ref__ and __unlock_ref__ shall be permitted. A thread that already has exclusive ownership of a given __recursive_mutex__ instance can call __lock_ref__ or __try_lock_ref__ to acquire an additional level of ownership of the mutex. __unlock_ref__ must be called once for -each level of ownership acquired by a single thread before ownership can be acquired by another thread. +each level of ownership acquired by a single thread before ownership can be acquired by another thread.\n +__recursive_mutex__ 实现了 __lockable_concept__,提供一个递归式的互斥量。对 于一个 __recursive_mutex__ 实例最多允许一个线程拥有其锁定。 +支持函数 __lock_ref__, __try_lock_ref__ 和 __unlock_ref__ 并发调用。如果一 个线程已经锁定一个 __recursive_mutex__ 实例, +那么这个线程可以多次通过 __lock_ref__ 或 __try_lock_ref__ 锁定这个实例,针 对每一次成功的锁定动作,需要调用 __unlock_ref__ 来解锁。

 [section:nativehandle Member function `native_handle()`]

@@ -146,9 +161,12 @@
 [variablelist

[[Effects:] [Returns an instance of `native_handle_type` that can be used with platform-specific APIs to manipulate the underlying -implementation. If no such instance exists, `native_handle()` and `native_handle_type` are not present.]]
-
-[[Throws:] [Nothing.]]
+implementation. If no such instance exists, `native_handle()` and `native_handle_type` are not present.\n +返回一个 `native_handle_type` 实例,可以通过系统平台函数访问该实例。如果平 台上没有这种类型,
+则 `native_handle()` 和 `native_handle_type` 也不会存在。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -162,7 +180,8 @@

     typedef recursive_mutex recursive_try_mutex;

-__recursive_try_mutex__ is a `typedef` to __recursive_mutex__, provided for backwards compatibility with previous releases of boost. +__recursive_try_mutex__ is a `typedef` to __recursive_mutex__, provided for backwards compatibility with previous releases of boost.\n +__recursive_try_mutex__ 是 __recursive_mutex__ 的 `typedef`, 用于兼容以前的 版本。

 [endsect]

@@ -199,7 +218,11 @@
__try_lock_ref__, __timed_lock_ref__, __timed_lock_duration_ref__ and __unlock_ref__ shall be permitted. A thread that already has exclusive ownership of a given __recursive_timed_mutex__ instance can call __lock_ref__, __timed_lock_ref__, __timed_lock_duration_ref__ or __try_lock_ref__ to acquire an additional level of ownership of the mutex. __unlock_ref__ must be -called once for each level of ownership acquired by a single thread before ownership can be acquired by another thread. +called once for each level of ownership acquired by a single thread before ownership can be acquired by another thread.\n +__recursive_timed_mutex__ 实现了 __timed_lockable_concept__,提供一个递归式 的互斥量。对于一个 __recursive_timed_mutex__ 实例, +最多允许一个线程拥有其锁定。支持函数 __lock_ref__, __try_lock_ref__, __timed_lock_ref__, __timed_lock_duration_ref__ 和 __unlock_ref__ +并发调用。如果一个线程已经锁定一个 __recursive_timed_mutex__ 实例,那么这个 线程可以多次通过 __lock_ref__, __timed_lock_ref__, +__timed_lock_duration_ref__ 或 __try_lock_ref__ 锁定这个实例,针对每一次成 功的锁定动作,需要调用 __unlock_ref__ 来解锁。

 [section:nativehandle Member function `native_handle()`]

@@ -209,9 +232,12 @@
 [variablelist

[[Effects:] [Returns an instance of `native_handle_type` that can be used with platform-specific APIs to manipulate the underlying -implementation. If no such instance exists, `native_handle()` and `native_handle_type` are not present.]]
-
-[[Throws:] [Nothing.]]
+implementation. If no such instance exists, `native_handle()` and `native_handle_type` are not present.\n +返回一个 `native_handle_type` 实例,可以通过系统平台函数访问该实例。如果平 台上没有这种类型,
+则 `native_handle()` 和 `native_handle_type` 也不会存在。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

=======================================
--- /trunk/libs/thread/doc/once.qbk     Mon Dec 28 23:05:14 2009
+++ /trunk/libs/thread/doc/once.qbk     Sun Feb  7 05:34:27 2010
@@ -7,7 +7,8 @@

 [section:once One-time Initialization]

-`boost::call_once` provides a mechanism for ensuring that an initialization routine is run exactly once without data races or deadlocks. +`boost::call_once` provides a mechanism for ensuring that an initialization routine is run exactly once without data races or deadlocks.\n +`boost::call_once` 提供一个机制,确保初始化函数只执行一次,并避免数据竞态或 死锁。

 [section:once_flag Typedef `once_flag`]

@@ -16,13 +17,14 @@
     typedef platform-specific-type once_flag;
     #define BOOST_ONCE_INIT platform-specific-initializer

-Objects of type `boost::once_flag` shall be initialized with `BOOST_ONCE_INIT`: +Objects of type `boost::once_flag` shall be initialized with `BOOST_ONCE_INIT`:\n
+`boost::once_flag` 对象由 `BOOST_ONCE_INIT` 初始化:

     boost::once_flag f=BOOST_ONCE_INIT;

 [endsect]

-[section:call_once Non-member function `call_once`]
+[section:call_once Non-member function `call_once`  自由函数`call_once`]

     #include <boost/thread/once.hpp>

@@ -32,25 +34,33 @@
 [variablelist

[[Requires:] [`Callable` is `CopyConstructible`. Copying `func` shall have no side effects, and the effect of calling the copy shall
-be equivalent to calling the original. ]]
+be equivalent to calling the original. \n
+`Callable` 类型要求 `CopyConstructible`。拷贝 `func` 不能有副效果,并且拷贝 和原始对象有相同的调用效果。]]

[[Effects:] [Calls to `call_once` on the same `once_flag` object are serialized. If there has been no prior effective `call_once` on the same `once_flag` object, the argument `func` (or a copy thereof) is called as-if by invoking `func()`, and the invocation of `call_once` is effective if and only if `func()` returns without exception. If an exception is thrown, the exception is propagated to the caller. If there has been a prior effective `call_once` on the same `once_flag` object, the `call_once` returns
-without invoking `func`. ]]
+without invoking `func`. \n
+对同一个 `once_flag` 对象调用 `call_once` 被序列化了。如果在此之前对于同一 个 `once_flag` 对象没有有效的 `call_once` 调用, +则参数 `func` (或其拷贝)被通过 `func()` 调用,当且仅当 `func()` 成功返 回,`call_once` 调用被视为有效的。 +如果有异常抛出,则该异常被传递到调用者。`call_once` 调用被视为无效的;如果 对同一个 `once_flag` 对象有过有效的 `call_once` 调用,
+则 `call_once` 只是简单返回,并不调用 `func`。]]

[[Synchronization:] [The completion of an effective `call_once` invocation on a `once_flag` object, synchronizes with
-all subsequent `call_once` invocations on the same `once_flag` object. ]]
-
-[[Throws:] [`thread_resource_error` when the effects cannot be achieved. or any exception propagated from `func`.]]
+all subsequent `call_once` invocations on the same `once_flag` object. \n
+对 `once_flag` 对象有效调用 `call_once` 后,后续对该 `once_flag` 的 `call_once` 调用会被同步。]]
+
+[[Throws:] [`thread_resource_error` when the effects cannot be achieved. or any exception propagated from `func`.\n +如果初始化效果不能达到,抛出 `thread_resource_error`,或者 `func` 抛出的异 常。]]

 ]

     void call_once(void (*func)(),once_flag& flag);

This second overload is provided for backwards compatibility. The effects of `call_once(func,flag)` shall be the same as those of
-`call_once(flag,func)`.
+`call_once(flag,func)`.\n
+第二个重载提供向前的兼容支持。函数 `call_once(func,flag)` 的效果和 `call_once(flag,func)` 一样。

 [endsect]
 [endsect]
=======================================
--- /trunk/libs/thread/doc/overview.qbk Mon Dec 28 23:05:14 2009
+++ /trunk/libs/thread/doc/overview.qbk Sun Feb  7 05:34:27 2010
@@ -5,11 +5,13 @@
   http://www.boost.org/LICENSE_1_0.txt).
 ]

-[section:overview Overview]
+[section:overview Overview 简介]

__boost_thread__ enables the use of multiple threads of execution with shared data in portable C++ code. It provides classes and functions for managing the threads themselves, along with others for synchronizing data between the threads or providing separate
-copies of data specific to individual threads.
+copies of data specific to individual threads.\n
+__boost_thread__ 使我们能够在可移植的C++代码中使用带有共享数据的多线程执 行。它提供了一些类和函数来管理线程,
+以及在线程间同步数据或者为每个线程提供独立的数据拷贝。

The __boost_thread__ library was originally written and designed by William E. Kempf. This version is a major rewrite designed to closely follow the proposals presented to the C++ Standards Committee, in particular
@@ -17,14 +19,22 @@
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2320.html N2320], [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2184.html N2184], [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2139.html N2139], and
-[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2094.html N2094]
+[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2094.html N2094]\n +__boost_thread__ 库起初是由 William E. Kempf 设计和实现的。这个版本进行了大 量重写以紧随C++标准委员会所发布的建议,尤其是 +[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2497.html N2497], +[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2320.html N2320], +[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2184.html N2184], +[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2139.html N2139], 和
+[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2094.html N2094]

 In order to use the classes and functions described here, you can
 either include the specific headers specified by the descriptions of
-each class or function, or include the master thread library header:
+each class or function, or include the master thread library header:\n
+为了使用在此文档中所介绍的类和函数,你要么包含在每个类或函数的说明中所指定 的特定头文件,要么包含这个线程库的主头文件:

     #include <boost/thread.hpp>

-which includes all the other headers in turn.
+which includes all the other headers in turn.\n
+该头文件将转而包含所有其它头文件。

 [endsect]
=======================================
--- /trunk/libs/thread/doc/shared_mutex_ref.qbk Mon Dec 28 23:05:14 2009
+++ /trunk/libs/thread/doc/shared_mutex_ref.qbk Sun Feb  7 05:34:27 2010
@@ -35,10 +35,13 @@
     };

The class `boost::shared_mutex` provides an implementation of a multiple-reader / single-writer mutex. It implements the
-__upgrade_lockable_concept__.
+__upgrade_lockable_concept__.\n
+`boost::shared_mutex&` 提供了一个"多读/单写"的互斥量。它实现了 __upgrade_lockable_concept__。

Multiple concurrent calls to __lock_ref__, __try_lock_ref__, __timed_lock_ref__, __lock_shared_ref__, __try_lock_shared_ref__ and
-__timed_lock_shared_ref__ shall be permitted.
+__timed_lock_shared_ref__ shall be permitted.\n
+允许并发调用 __lock_ref__, __try_lock_ref__, __timed_lock_ref__, __lock_shared_ref__, __try_lock_shared_ref__
+和 __timed_lock_shared_ref__。


 [endsect]
=======================================
--- /trunk/libs/thread/doc/thread.qbk   Mon Dec 28 23:05:14 2009
+++ /trunk/libs/thread/doc/thread.qbk   Sun Feb  7 05:34:27 2010
@@ -152,7 +152,7 @@

 [include thread_ref.qbk]

-[section:synchronization Synchronization]
+[section:synchronization Synchronization 同步处理]
 [include mutex_concepts.qbk]
 [include mutexes.qbk]
 [include condition_variables.qbk]
=======================================
--- /trunk/libs/thread/doc/thread_ref.qbk       Mon Dec 28 23:05:14 2009
+++ /trunk/libs/thread/doc/thread_ref.qbk       Sun Feb  7 05:34:27 2010
@@ -5,16 +5,19 @@
   http://www.boost.org/LICENSE_1_0.txt).
 ]

-[section:thread_management Thread Management]
-
-[heading Synopsis]
+[section:thread_management Thread Management 线程管理]
+
+[heading Synopsis 概要]

The __thread__ class is responsible for launching and managing threads. Each __thread__ object represents a single thread of execution, or __not_a_thread__, and at most one __thread__ object represents a given thread of execution: objects of type __thread__ are not
-copyable.
+copyable.\n
+__thread__ 类的职责是启动和管理线程对象。每一个 __thread__ 实例表示单个执行 线程或 __not_a_thread__, +而多数时候一个 __thread__ 对象代表一个给定的执行线程: __thread__ 类型的对象 是不可拷贝的。

Objects of type __thread__ are movable, however, so they can be stored in move-aware containers, and returned from functions. This
-allows the details of thread creation to be wrapped in a function.
+allows the details of thread creation to be wrapped in a function.\n
+__thread__ 类型的对象是可转移的, 因此它们可以被存放到支持转移语义的容器中, 由函数返回。这样使得线程对象的创建细节可以用函数包装起来。

     boost::thread make_thread();

@@ -26,17 +29,22 @@

[Note: On compilers that support rvalue references, __thread__ provides a proper move constructor and move-assignment operator, and therefore meets the C++0x ['MoveConstructible] and ['MoveAssignable] concepts. With such compilers, __thread__ can therefore be used
-with containers that support those concepts.
+with containers that support those concepts.\n
+注: 在支持右值引用的编译器上,__thread__ 提供一个适当的转移构造函数和转移赋 值操作, 以此来符合C++0x中的 +['可转移拷贝]和['可转移赋值]的概念。在这些编译器的帮助下, __thread__ 能够用 于支持转移语义的容器。

For other compilers, move support is provided with a move emulation layer, so containers must explicitly detect that move emulation
-layer. See <boost/thread/detail/move.hpp> for details.]
-
-[heading Launching threads]
+layer. See <boost/thread/detail/move.hpp> for details.\n
+对于其他的编译器, 转移语义由一个转移模仿层来支持, 这样容器需要显式检测模仿 层。 详细资料参考 <boost/thread/detail/move.hpp>]
+
+[heading Launching threads 启动线程]

A new thread is launched by passing an object of a callable type that can be invoked with no parameters to the constructor. The object is then copied into internal storage, and invoked on the newly-created thread of execution. If the object must not (or cannot) be copied, then `boost::ref` can be used to pass in a reference to the function object. In this case, the user of -__boost_thread__ must ensure that the referred-to object outlives the newly-created thread of execution. +__boost_thread__ must ensure that the referred-to object outlives the newly-created thread of execution.\n +通过传递一个拥有无参数构造函数的可调用对象来启动一个线程。这个对象会被拷贝 进内部存储,然后在新创建的线程执行时被调用。 +如果对象不能被拷贝,可以通过 `boost::ref` 传递一个引用。在此种状况 下,__boost_thread__ 的用户必须确保该对象在线程执行期间存在。

     struct callable
     {
@@ -57,46 +65,60 @@
       // this leads to undefined behaviour

If you wish to construct an instance of __thread__ with a function or callable object that requires arguments to be supplied, -this can be done by passing additional arguments to the __thread__ constructor: +this can be done by passing additional arguments to the __thread__ constructor:\n +如果你希望通过带参数的函数或可调用对象来构造一个 __thread__ 对象,可以通过 将额外的参数传递给 __thread__ 构造函数的方法来实现:

     void find_the_question(int the_answer);

     boost::thread deep_thought_2(find_the_question,42);

The arguments are ['copied] into the internal thread structure: if a reference is required, use `boost::ref`, just as for references
-to callable functions.
-
-There is an unspecified limit on the number of additional arguments that can be passed.
-
-[heading Exceptions in thread functions]
+to callable functions.\n
+参数会['被拷贝]到线程内部: 如果需要使用参数引用, 请使用 `boost::ref,参照可 调用对象的引用方法。
+
+There is an unspecified limit on the number of additional arguments that can be passed.\n
+对于额外参数的个数没有限制。
+
+[heading Exceptions in thread functions 线程函数中的异常]

If the function or callable object passed to the __thread__ constructor propagates an exception when invoked that is not of type
-__thread_interrupted__, `std::terminate()` is called.
-
-[heading Joining and detaching]
+__thread_interrupted__, `std::terminate()` is called. \n
+如果传递给 __thread__ 构造函数的线程函数或可调用对象在被调用时产生一个非 __thread_interrupted__ 类型的异常,`std::terminate()` 会被调用。
+
+[heading Joining and detaching 邻连和分离]

When the __thread__ object that represents a thread of execution is destroyed the thread becomes ['detached]. Once a thread is detached, it will continue executing until the invocation of the function or callable object supplied on construction has completed, or the program is terminated. A thread can also be detached by explicitly invoking the __detach__ member function on the __thread__ -object. In this case, the __thread__ object ceases to represent the now-detached thread, and instead represents __not_a_thread__. +object. In this case, the __thread__ object ceases to represent the now-detached thread, and instead represents __not_a_thread__.\n +当代表的线程执行体的 __thread__ 对象被销毁的时候,线程执行体处于被分离的状 态。线程执行体此时继续执行, +直到线程函数或可调用对象执行结束, 或者程序终止。线程执行体也可以通过显式调 用 __thread__ 成员函数 __detach__ 分离, +在这种状况下,__thread__ 对象结束了和线程执行体的关系,变为代表 __not_a_thread__。

In order to wait for a thread of execution to finish, the __join__ or __timed_join__ member functions of the __thread__ object must be used. __join__ will block the calling thread until the thread represented by the __thread__ object has completed. If the thread of execution represented by the __thread__ object has already completed, or the __thread__ object represents __not_a_thread__, then __join__ returns immediately. __timed_join__ is similar, except that a call to __timed_join__ will also return if the thread being waited for
-does not complete when the specified time has elapsed.
-
-[heading Interruption]
+does not complete when the specified time has elapsed.\n
+如果要等待一个线程结束, 使用 __thread__ 对象的成员函数 __join__ 或 __timed_join__。函数 __join__ 会阻塞调用线程直到等待的 __thread__ +对象执行结束。如果等待的 __thread__ 对象已经结束,或者等待的 __thread__ 对 象表示 __not_a_thread__, 函数 __join__ 会立即返回。 +函数 __timed_join__ 也类似, 只是 __timed_join__ 在等待指定的时间后也会返 回。
+
+[heading Interruption 中断]

A running thread can be ['interrupted] by invoking the __interrupt__ member function of the corresponding __thread__ object. When the interrupted thread next executes one of the specified __interruption_points__ (or if it is currently __blocked__ whilst executing one) with interruption enabled, then a __thread_interrupted__ exception will be thrown in the interrupted thread. If not caught, this will cause the execution of the interrupted thread to terminate. As with any other exception, the stack will be unwound, and
-destructors for objects of automatic storage duration will be executed.
+destructors for objects of automatic storage duration will be executed.\n
+一个执行着的线程可以通过调用对应 __thread__ 对象的函数 __interrupt__ 来['中 断]。当一个被中断的线程在中断打开时再次执行到某个特定的 +__interruption_points__ (或是它当前被 __blocked__ 而执行一个) , 它会触发一 个 __thread_interrupted__ 异常。如果这个异常没有被捕捉,
+会导致该线程终止。如同其它异常一样, 栈会被展开, 自动变量会被析构。

If a thread wishes to avoid being interrupted, it can create an instance of __disable_interruption__. Objects of this class disable interruption for the thread that created them on construction, and restore the interruption state to whatever it was before on
-destruction:
+destruction:\n
+如果一个线程不希望被中断, 可以创建一个 __disable_interruption__ 对象来达到 这个目的。该对象创建成功后,线程中断关闭,直到该对象被销毁:

     void f()
     {
@@ -116,7 +138,10 @@
The effects of an instance of __disable_interruption__ can be temporarily reversed by constructing an instance of __restore_interruption__, passing in the __disable_interruption__ object in question. This will restore the interruption state to what it was when the __disable_interruption__ object was constructed, and then -disable interruption again when the __restore_interruption__ object is destroyed. +disable interruption again when the __restore_interruption__ object is destroyed.\n +__disable_interruption__ 对象关闭的线程中断可以通过构建一个 __restore_interruption__ 对象来临时打开, +并在构造时传递对应的 __disable_interruption__ 对象。这样将恢复线程中断状态 到构建 __disable_interruption__ 对象之前,
+当 __restore_interruption__ 对象销毁的时候,线程中断会再次处于关闭。

     void g()
     {
@@ -132,14 +157,16 @@
         // interruption now enabled
     }

-At any point, the interruption state for the current thread can be queried by calling __interruption_enabled__. +At any point, the interruption state for the current thread can be queried by calling __interruption_enabled__.\n
+在任何时候,线程中断状态可以通过函数 __interruption_enabled__ 来取得。

 [#interruption_points]

-[heading Predefined Interruption Points]
+[heading Predefined Interruption Points 预定义的中断点]

The following functions are ['interruption points], which will throw __thread_interrupted__ if interruption is enabled for the
-current thread, and interruption is requested for the current thread:
+current thread, and interruption is requested for the current thread:\n
+下列函数是['中断点], 会在被调用线程对象中断开启的情况下抛出 __thread_interrupted__ 异常:

 * [join_link `boost::thread::join()`]
 * [timed_join_link `boost::thread::timed_join()`]
@@ -151,17 +178,22 @@
 * __sleep__
 * __interruption_point__

-[heading Thread IDs]
+[heading Thread IDs 线程标识]

Objects of class __thread_id__ can be used to identify threads. Each running thread of execution has a unique ID obtainable from the corresponding __thread__ by calling the `get_id()` member function, or by calling `boost::this_thread::get_id()` from within the thread. Objects of class __thread_id__ can be copied, and used as keys in associative containers: the full range of comparison operators is provided. Thread IDs can also be written to an output stream using the stream insertion operator, though the
-output format is unspecified.
+output format is unspecified.\n
+__thread_id__ 对象可用于标识线程。每个执行期的线程都有一个唯一的标识,可通 过对应 __thread__ 的成员函数 `get_id()` 获得, +或者在线程内部通过函数 `boost::this_thread::get_id()` 获得。__thread_id__ 对象支持拷贝, 并提供完整的比较操作符, +可以用于关联式容器的键值。尽管没有指定输出格式,线程标识还是可以用标准操作 输出到流。

Each instance of __thread_id__ either refers to some thread, or __not_a_thread__. Instances that refer to __not_a_thread__ compare equal to each other, but not equal to any instances that refer to an actual thread of execution. The comparison operators on
-__thread_id__ yield a total order for every non-equal thread ID.
+__thread_id__ yield a total order for every non-equal thread ID.\n
+__thread_id__ 对象可能标识线程, 也可能是 __not_a_thread__。 __not_a_thread__ 在比较时都是相同的, 但是和任何实际运行的线程相比较则都不一 样。
+__thread_id__ 的比较操作生成每个不同线程ID的全序。

 [section:thread Class `thread`]

@@ -220,74 +252,89 @@

     void swap(thread& lhs,thread& rhs);

-[section:default_constructor Default Constructor]
+[section:default_constructor Default Constructor 默认构造函数]

     thread();

 [variablelist

-[[Effects:] [Constructs a __thread__ instance that refers to __not_a_thread__.]]
-
-[[Throws:] [Nothing]]
+[[Effects:] [Constructs a __thread__ instance that refers to __not_a_thread__.\n
+创建一个表示 __not_a_thread__ 的 __thread__ 对象。]]
+
+[[Throws:] [Nothing\n
+无]]

 ]

 [endsect]

-[section:callable_constructor Thread Constructor]
+[section:callable_constructor Thread Constructor 线程构造函数]

     template<typename Callable>
     thread(Callable func);

 [variablelist

-[[Preconditions:] [`Callable` must by copyable.]]
+[[Preconditions:] [`Callable` must by copyable.\n
+`Callable` 支持拷贝。]]

[[Effects:] [`func` is copied into storage managed internally by the thread library, and that copy is invoked on a newly-created thread of execution. If this invocation results in an exception being propagated into the internals of the thread library that is -not of type __thread_interrupted__, then `std::terminate()` will be called.]]
-
-[[Postconditions:] [`*this` refers to the newly created thread of execution.]]
-
-[[Throws:] [__thread_resource_error__ if an error occurs.]]
+not of type __thread_interrupted__, then `std::terminate()` will be called.\n +对象 `func` 被拷贝到 thread 库管理的内部存储区, 这份拷贝在稍后创建的线程中 被调用。 +如果这个调用产生一个非 __thread_interrupted__ 异常,并被传递到库内部, 函数 `std::terminate()` 会被调用。]]
+
+[[Postconditions:] [`*this` refers to the newly created thread of execution.\n
+`*this` 引用创建出来的线程执行体。]]
+
+[[Throws:] [__thread_resource_error__ if an error occurs.\n
+如果出错,抛出 __thread_resource_error__ 异常。]]

 ]

 [endsect]

-[section:multiple_argument_constructor Thread Constructor with arguments]
+[section:multiple_argument_constructor Thread Constructor with arguments 带 参数的构造函数]

     template <class F,class A1,class A2,...>
     thread(F f,A1 a1,A2 a2,...);

 [variablelist

-[[Preconditions:] [`F` and each `A`n must by copyable or movable.]]
+[[Preconditions:] [`F` and each `A`n must by copyable or movable.\n
+参数 `F` 和 `A`n 需要支持拷贝或者转移语义。]]

 [[Effects:] [As if [link
 thread.thread_management.thread.callable_constructor
-`thread(boost::bind(f,a1,a2,...))`. Consequently, `f` and each `a`n
-are copied into internal storage for access by the new thread.]]]
-
-[[Postconditions:] [`*this` refers to the newly created thread of execution.]]
-
-[[Throws:] [__thread_resource_error__ if an error occurs.]]
-
-[[Note:] [Currently up to nine additional arguments `a1` to `a9` can be specified in addition to the function `f`.]]
+`thread(boost::bind(f,a1,a2,...))`]. Consequently, `f` and each `a`n
+are copied into internal storage for access by the new thread.\n
+类似 [link thread.thread_management.thread.callable_constructor `thread(boost::bind(f,a1,a2,...))`]。
+结果是, `f` 和 `a`n 被拷贝到线程内部存储由线程对象访问。]]
+
+[[Postconditions:] [`*this` refers to the newly created thread of execution.\n
+`*this` 引用创建出来的线程执行体。]]
+
+[[Throws:] [__thread_resource_error__ if an error occurs.\n
+如果出错,抛出 __thread_resource_error__ 异常。]]
+
+[[Note:] [Currently up to nine additional arguments `a1` to `a9` can be specified in addition to the function `f`.\n
+目前最多支持带九个额外参数(`a1` 到 `a9`)的 `f`。]]

 ]

 [endsect]

-[section:destructor Thread Destructor]
+[section:destructor Thread Destructor 析构函数]

     ~thread();

 [variablelist

-[[Effects:] [If `*this` has an associated thread of execution, calls __detach__. Destroys `*this`.]]
-
-[[Throws:] [Nothing.]]
+[[Effects:] [If `*this` has an associated thread of execution, calls __detach__. Destroys `*this`.\n
+如果 `*this` 标识一个线程执行体, 调用函数 __detach__。销毁 `*this`。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -299,9 +346,11 @@

 [variablelist

-[[Returns:] [`true` if `*this` refers to a thread of execution, `false` otherwise.]]
-
-[[Throws:] [Nothing]]
+[[Returns:] [`true` if `*this` refers to a thread of execution, `false` otherwise.\n
+如果 `*this` 标识一个线程执行体, 返回 `true`,否则返回 `false`。]]
+
+[[Throws:] [Nothing\n
+无]]

 ]

@@ -316,13 +365,17 @@

 [[Preconditions:] [`this->get_id()!=boost::this_thread::get_id()`]]

-[[Effects:] [If `*this` refers to a thread of execution, waits for that thread of execution to complete.]]
-
-[[Postconditions:] [If `*this` refers to a thread of execution on entry, that thread of execution has completed. `*this` no longer refers to any thread of execution.]]
-
-[[Throws:] [__thread_interrupted__ if the current thread of execution is interrupted.]]
-
-[[Notes:] [`join()` is one of the predefined __interruption_points__.]]
+[[Effects:] [If `*this` refers to a thread of execution, waits for that thread of execution to complete.\n
+如果 `*this` 标识一个线程执行体, 调用者等待线程对象执行结束。]]
+
+[[Postconditions:] [If `*this` refers to a thread of execution on entry, that thread of execution has completed. `*this` no longer refers to any thread of execution.\n
+如果 `*this` 标识一个线程执行体, 线程结束。`*this` 不再标识任何执行体。]]
+
+[[Throws:] [__thread_interrupted__ if the current thread of execution is interrupted.\n
+如果该线程被中断,抛出 __thread_interrupted__ 异常。]]
+
+[[Notes:] [`join()` is one of the predefined __interruption_points__.\n
+`join()` 是预定义的 __interruption_points__。 ]]

 ]

@@ -340,18 +393,25 @@
 [[Preconditions:] [`this->get_id()!=boost::this_thread::get_id()`]]

[[Effects:] [If `*this` refers to a thread of execution, waits for that thread of execution to complete, the time `wait_until` has -been reach or the specified duration `rel_time` has elapsed. If `*this` doesn't refer to a thread of execution, returns immediately.]] +been reach or the specified duration `rel_time` has elapsed. If `*this` doesn't refer to a thread of execution, returns immediately.\n +如果 `*this` 标识一个线程执行体, 调用者等待线程对象执行结束, 时间 `wait_until` 到达,或者指定 `rel_time` 时间过去。
+如果 `*this` 并不标识线程执行体, 立即返回。]]

[[Returns:] [`true` if `*this` refers to a thread of execution on entry, and that thread of execution has completed before the call
-times out, `false` otherwise.]]
+times out, `false` otherwise.\n
+如果 `*this` 标识一个线程执行体,并且线程在等待时间结束前结束,返回 `true`,否则返回 `false`。]]

[[Postconditions:] [If `*this` refers to a thread of execution on entry, and `timed_join` returns `true`, that thread of execution has completed, and `*this` no longer refers to any thread of execution. If this call to `timed_join` returns `false`, `*this` is
-unchanged.]]
-
-[[Throws:] [__thread_interrupted__ if the current thread of execution is interrupted.]]
-
-[[Notes:] [`timed_join()` is one of the predefined __interruption_points__.]]
+unchanged.\n
+如果 `*this` 标识一个线程执行体 , 并且 `timed_join` 返回 `true`, 则线程执行 体已经结束, `*this` 不再标识任何执行体。
+如果 `timed_join` 返回 `false`, `*this` 不变。 ]]
+
+[[Throws:] [__thread_interrupted__ if the current thread of execution is interrupted.\n
+如果该线程被中断,抛出 __thread_interrupted__ 异常。]]
+
+[[Notes:] [`timed_join()` is one of the predefined __interruption_points__.\n
+`timed_join()` 是预定义的 __interruption_points__。]]

 ]

@@ -363,11 +423,14 @@

 [variablelist

-[[Effects:] [If `*this` refers to a thread of execution, that thread of execution becomes detached, and no longer has an associated __thread__ object.]]
-
-[[Postconditions:] [`*this` no longer refers to any thread of execution.]]
-
-[[Throws:] [Nothing]]
+[[Effects:] [If `*this` refers to a thread of execution, that thread of execution becomes detached, and no longer has an associated __thread__ object.\n +如果 `*this` 标识一个线程执行体, 则线程执行体被分离, 不再具有一个关联的 __thread__ 对象。]]
+
+[[Postconditions:] [`*this` no longer refers to any thread of execution.\n
+`*this` 不再标识任何执行体。]]
+
+[[Throws:] [Nothing\n
+无]]

 ]

@@ -381,9 +444,11 @@
 [variablelist

[[Returns:] [If `*this` refers to a thread of execution, an instance of __thread_id__ that represents that thread. Otherwise returns
-a default-constructed __thread_id__.]]
-
-[[Throws:] [Nothing]]
+a default-constructed __thread_id__.\n
+如果 `*this` 标识一个线程执行体, 返回表示该线程的 __thread_id__。否则返回空 的 __thread_id__。]]
+
+[[Throws:] [Nothing\n
+无]]

 ]

@@ -397,9 +462,12 @@

[[Effects:] [If `*this` refers to a thread of execution, request that the thread will be interrupted the next time it enters one of the predefined __interruption_points__ with interruption enabled, or if it is currently __blocked__ in a call to one of the
-predefined __interruption_points__ with interruption enabled .]]
-
-[[Throws:] [Nothing]]
+predefined __interruption_points__ with interruption enabled .\n
+如果 `*this` 标识一个线程执行体, 则请求该线程在下次进入某个带有中断激活的预 定义 __interruption_points__ 时被中断, +或如果线程当前是 __blocked__,则在调用某个带有中断激活的预定义 __interruption_points__ 时。 ]]
+
+[[Throws:] [Nothing\n
+无]]

 ]

@@ -413,9 +481,11 @@
 [variablelist

[[Returns:] [The number of hardware threads available on the current system (e.g. number of CPUs or cores or hyperthreading units),
-or 0 if this information is not available.]]
-
-[[Throws:] [Nothing]]
+or 0 if this information is not available.\n
+返回当前硬件系统支持的线程数量(处理器内核数量), 如果当前信息不可用,返回 0。]]
+
+[[Throws:] [Nothing\n
+无]]

 ]

@@ -429,9 +499,12 @@
 [variablelist

[[Effects:] [Returns an instance of `native_handle_type` that can be used with platform-specific APIs to manipulate the underlying -implementation. If no such instance exists, `native_handle()` and `native_handle_type` are not present.]]
-
-[[Throws:] [Nothing.]]
+implementation. If no such instance exists, `native_handle()` and `native_handle_type` are not present.\n +返回一个 `native_handle_type` 实例,该实例支持平台特定的线程访问函数。 如果 该平台不支持,
+函数 `native_handle()` 和类型 `native_handle_type` 都不存在。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -467,11 +540,14 @@

 [variablelist

-[[Effects:] [Suspends the current thread until the specified time has been reached.]]
-
-[[Throws:] [__thread_interrupted__ if the current thread of execution is interrupted.]]
-
-[[Notes:] [`sleep()` is one of the predefined __interruption_points__.]]
+[[Effects:] [Suspends the current thread until the specified time has been reached.\n
+将调用线程挂起指定的时间。]]
+
+[[Throws:] [__thread_interrupted__ if the current thread of execution is interrupted.\n
+如果线程中断,抛出 __thread_interrupted__ 异常。]]
+
+[[Notes:] [`sleep()` is one of the predefined __interruption_points__.\n
+`sleep()` 是一个预定义 __interruption_points__。 ]]

 ]

@@ -483,7 +559,8 @@

 [variablelist

-[[Effects:] [See [link thread.thread_management.this_thread.yield `boost::this_thread::yield()`].]] +[[Effects:] [See [link thread.thread_management.this_thread.yield `boost::this_thread::yield()`].\n +参考 [link thread.thread_management.this_thread.yield `boost::this_thread::yield()`]。]]

 ]

@@ -496,12 +573,15 @@
 [variablelist

[[Effects:] [Exchanges the threads of execution associated with `*this` and `other`, so `*this` is associated with the thread of
-execution associated with `other` prior to the call, and vice-versa.]]
+execution associated with `other` prior to the call, and vice-versa.\n
+交换 `*this` 和 `other` 所关联的线程执行体,因此 `*this` 将关联至之前 `other` 所关联的线程执行体,反之亦然。]]

[[Postconditions:] [`this->get_id()` returns the same value as `other.get_id()` prior to the call. `other.get_id()` returns the same
-value as `this->get_id()` prior to the call.]]
-
-[[Throws:] [Nothing.]]
+value as `this->get_id()` prior to the call.\n
+`this->get_id()` 返回与之前 `other.get_id()` 相同的值。`other.get_id()` 则 返回与之前 `this->get_id()` 相同的值。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -543,15 +623,17 @@
         operator<<(std::basic_ostream<charT, traits>& os, const id& x);
     };

-[section:constructor Default constructor]
+[section:constructor Default constructor 默认构造函数]

     id();

 [variablelist

-[[Effects:] [Constructs a __thread_id__ instance that represents __not_a_thread__.]]
-
-[[Throws:] [Nothing]]
+[[Effects:] [Constructs a __thread_id__ instance that represents __not_a_thread__.\n
+构造一个表示 __not_a_thread__ 的 __thread_id__。]]
+
+[[Throws:] [Nothing\n
+无]]

 ]

@@ -564,9 +646,11 @@
 [variablelist

[[Returns:] [`true` if `*this` and `y` both represent the same thread of execution, or both represent __not_a_thread__, `false`
-otherwise.]]
-
-[[Throws:] [Nothing]]
+otherwise.\n
+如果 `*this` 和 `y` 代表同一个线程执行体, 或者都标识 __not_a_thread__, 返 回 `true`, 否则返回 `false`。]]
+
+[[Throws:] [Nothing\n
+无]]

 ]

@@ -579,9 +663,11 @@
 [variablelist

[[Returns:] [`true` if `*this` and `y` represent different threads of execution, or one represents a thread of execution, and
-the other represent __not_a_thread__, `false` otherwise.]]
-
-[[Throws:] [Nothing]]
+the other represent __not_a_thread__, `false` otherwise.\n
+如果 `*this` 和 `y` 代表不同的线程执行体, 或者一个代表线程执行体,而另一个 标识 __not_a_thread__, 返回 `true`, 否则返回 `false`。]]
+
+[[Throws:] [Nothing\n
+无]]

 ]

@@ -594,12 +680,15 @@
 [variablelist

[[Returns:] [`true` if `*this!=y` is `true` and the implementation-defined total order of __thread_id__ values places `*this` before
-`y`, `false` otherwise.]]
-
-[[Throws:] [Nothing]]
+`y`, `false` otherwise.\n
+如果 `*this!=y` 为 `true`,并且 __thread_id__ 定义的顺序中 `*this` 在 `y` 之前,返回 `true`, 否则返回 `false`。]]
+
+[[Throws:] [Nothing\n
+无]]

[[Note:] [A __thread_id__ instance representing __not_a_thread__ will always compare less than an instance representing a thread of
-execution.]]
+execution.\n
+如果一个 __thread_id__ 标识 __not_a_thread__,那么它小于任何一个代表线程执 行体的实例。]]

 ]

@@ -614,7 +703,8 @@

 [[Returns:] [`y<*this`]]

-[[Throws:] [Nothing]]
+[[Throws:] [Nothing\n
+无]]

 ]

@@ -628,7 +718,8 @@

 [[Returns:] [`!(y<*this)`]]

-[[Throws:] [Nothing]]
+[[Throws:] [Nothing\n
+无]]

 ]

@@ -642,7 +733,8 @@

 [[Returns:] [`!(*this<y)`]]

-[[Throws:] [Nothing]]
+[[Throws:] [Nothing\n
+无]]

 ]

@@ -657,7 +749,9 @@
 [variablelist

[[Effects:] [Writes a representation of the __thread_id__ instance `x` to the stream `os`, such that the representation of two -instances of __thread_id__ `a` and `b` is the same if `a==b`, and different if `a!=b`.]] +instances of __thread_id__ `a` and `b` is the same if `a==b`, and different if `a!=b`.\n +将 __thread_id__ 实例 'x' 的表示法写入输出流 `os`,两个 __thread_id__ 实例 `a` 和 `b` 的表示法在 `a==b` 时是相同的,
+在 `a!=b` 时是不同的。]]

 [[Returns:] [`os`]]

@@ -683,9 +777,11 @@

 [variablelist

-[[Returns:] [An instance of __thread_id__ that represents that currently executing thread.]]
-
-[[Throws:] [__thread_resource_error__ if an error occurs.]]
+[[Returns:] [An instance of __thread_id__ that represents that currently executing thread.\n
+返回代表当前执行线程的 __thread_id__ 对象。]]
+
+[[Throws:] [__thread_resource_error__ if an error occurs.\n
+如果发生错误,抛出 __thread_resource_error__ 异常。]]

 ]

@@ -702,9 +798,11 @@

 [variablelist

-[[Effects:] [Check to see if the current thread has been interrupted.]]
-
-[[Throws:] [__thread_interrupted__ if __interruption_enabled__ and __interruption_requested__ both return `true`.]]
+[[Effects:] [Check to see if the current thread has been interrupted.\n
+检查当前线程是否被中断。]]
+
+[[Throws:] [__thread_interrupted__ if __interruption_enabled__ and __interruption_requested__ both return `true`.\n +如果 __interruption_enabled__ 并且 __interruption_requested__ 返回 `true`,抛出 __thread_interrupted__ 异常 。]]

 ]

@@ -721,9 +819,11 @@

 [variablelist

-[[Returns:] [`true` if interruption has been requested for the current thread, `false` otherwise.]]
-
-[[Throws:] [Nothing.]]
+[[Returns:] [`true` if interruption has been requested for the current thread, `false` otherwise.\n
+如果当前线程要求中断,返回 `true`,否则返回 `false`。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -740,9 +840,11 @@

 [variablelist

-[[Returns:] [`true` if interruption has been enabled for the current thread, `false` otherwise.]]
-
-[[Throws:] [Nothing.]]
+[[Returns:] [`true` if interruption has been enabled for the current thread, `false` otherwise.\n
+如果线程中断开启,返回 `true`,否则返回 `false`。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -760,11 +862,14 @@

 [variablelist

-[[Effects:] [Suspends the current thread until the specified time has elapsed.]]
-
-[[Throws:] [__thread_interrupted__ if the current thread of execution is interrupted.]]
-
-[[Notes:] [`sleep()` is one of the predefined __interruption_points__.]]
+[[Effects:] [Suspends the current thread until the specified time has elapsed.\n
+将调用线程挂起指定的时间。]]
+
+[[Throws:] [__thread_interrupted__ if the current thread of execution is interrupted.\n
+如果线程被中断,抛出 __thread_interrupted__ 异常。]]
+
+[[Notes:] [`sleep()` is one of the predefined __interruption_points__.\n
+`sleep()` 是一个预定义的 __interruption_points__。 ]]

 ]

@@ -781,9 +886,11 @@

 [variablelist

-[[Effects:] [Gives up the remainder of the current thread's time slice, to allow other threads to run.]]
-
-[[Throws:] [Nothing.]]
+[[Effects:] [Gives up the remainder of the current thread's time slice, to allow other threads to run.\n
+放弃当前线程当前时间片, 允许其他线程运行。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -804,37 +911,46 @@
     }

`boost::this_thread::disable_interruption` disables interruption for the current thread on construction, and restores the prior -interruption state on destruction. Instances of `disable_interruption` cannot be copied or moved.
-
-[section:constructor Constructor]
+interruption state on destruction. Instances of `disable_interruption` cannot be copied or moved.\n +`boost::this_thread::disable_interruption` 对象在构造时关闭当前线程中断, 在 析构后恢复线程中断状态。
+`disable_interruption` 对象不支持拷贝和转移。
+
+[section:constructor Constructor 构造函数]

     disable_interruption();

 [variablelist

-[[Effects:] [Stores the current state of __interruption_enabled__ and disables interruption for the current thread.]]
-
-[[Postconditions:] [__interruption_enabled__ returns `false` for the current thread.]]
-
-[[Throws:] [Nothing.]]
+[[Effects:] [Stores the current state of __interruption_enabled__ and disables interruption for the current thread.\n
+存贮当前 __interruption_enabled__ 状态并关闭当前线程中断。]]
+
+[[Postconditions:] [__interruption_enabled__ returns `false` for the current thread.\n
+函数 __interruption_enabled__ 返回 `false`。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

 [endsect]

-[section:destructor Destructor]
+[section:destructor Destructor 析构函数]

     ~disable_interruption();

 [variablelist

-[[Preconditions:] [Must be called from the same thread from which `*this` was constructed.]]
-
-[[Effects:] [Restores the current state of __interruption_enabled__ for the current thread to that prior to the construction of `*this`.]]
-
-[[Postconditions:] [__interruption_enabled__ for the current thread returns the value stored in the constructor of `*this`.]]
-
-[[Throws:] [Nothing.]]
+[[Preconditions:] [Must be called from the same thread from which `*this` was constructed.\n
+必须在 `*this` 构造时所在的线程内调用。]]
+
+[[Effects:] [Restores the current state of __interruption_enabled__ for the current thread to that prior to the construction of `*this`.\n
+恢复 `*this` 改变的 __interruption_enabled__ 状态。]]
+
+[[Postconditions:] [__interruption_enabled__ for the current thread returns the value stored in the constructor of `*this`.\n
+当前线程的 __interruption_enabled__ 状态恢复至 `*this` 构造之前。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -858,39 +974,49 @@

On construction of an instance of `boost::this_thread::restore_interruption`, the interruption state for the current thread is restored to the interruption state stored by the constructor of the supplied instance of __disable_interruption__. When the instance -is destroyed, interruption is again disabled. Instances of `restore_interruption` cannot be copied or moved.
-
-[section:constructor Constructor]
+is destroyed, interruption is again disabled. Instances of `restore_interruption` cannot be copied or moved.\n +`boost::this_thread::restore_interruption` 对象的构建将当前线程的中断状态恢 复至 __disable_interruption__ 对象存储的状态。
+当该对象析构时,中断再次关闭。`restore_interruption` 对象不支持拷贝和转移。
+
+[section:constructor Constructor 构造函数]

     explicit restore_interruption(disable_interruption& disabler);

 [variablelist

-[[Preconditions:] [Must be called from the same thread from which `disabler` was constructed.]]
-
-[[Effects:] [Restores the current state of __interruption_enabled__ for the current thread to that prior to the construction of `disabler`.]]
-
-[[Postconditions:] [__interruption_enabled__ for the current thread returns the value stored in the constructor of `disabler`.]]
-
-[[Throws:] [Nothing.]]
+[[Preconditions:] [Must be called from the same thread from which `disabler` was constructed.\n
+必须和 `disabler` 对象在同一个线程创建。]]
+
+[[Effects:] [Restores the current state of __interruption_enabled__ for the current thread to that prior to the construction of `disabler`.\n
+恢复当前线程的 __interruption_enabled__ 状体至 `disabler` 构造之前。]]
+
+[[Postconditions:] [__interruption_enabled__ for the current thread returns the value stored in the constructor of `disabler`.\n +对当前线程调用 __interruption_enabled__ 将返回保存在 `disabler` 构造函数中 的值。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

 [endsect]

-[section:destructor Destructor]
+[section:destructor Destructor 析构函数]

     ~restore_interruption();

 [variablelist

-[[Preconditions:] [Must be called from the same thread from which `*this` was constructed.]]
-
-[[Effects:] [Disables interruption for the current thread.]]
-
-[[Postconditions:] [__interruption_enabled__ for the current thread returns `false`.]]
-
-[[Throws:] [Nothing.]]
+[[Preconditions:] [Must be called from the same thread from which `*this` was constructed.\n
+必须和 `*this` 的构造函数在同一个线程调用。]]
+
+[[Effects:] [Disables interruption for the current thread.\n
+关闭当前线程中断。]]
+
+[[Postconditions:] [__interruption_enabled__ for the current thread returns `false`.\n
+当前线程 __interruption_enabled__ 返回 `false`。]]
+
+[[Throws:] [Nothing.\n
+无]]

 ]

@@ -909,19 +1035,25 @@

 [[Effects:] [A copy of `func` is placed in
 thread-specific storage. This copy is invoked when the current thread
-exits (even if the thread has been interrupted).]]
-
-[[Postconditions:] [A copy of `func` has been saved for invocation on thread exit.]]
+exits (even if the thread has been interrupted).\n
+拷贝 `func` 至线程相关存储区。这个拷贝在线程结束时被调用(即使线程被中断)。 ]]
+
+[[Postconditions:] [A copy of `func` has been saved for invocation on thread exit.\n
+`func` 的拷贝被保存,线程退出时调用。]]

[[Throws:] [`std::bad_alloc` if memory cannot be allocated for the copy of the function, __thread_resource_error__ if any other -error occurs within the thread library. Any exception thrown whilst copying `func` into internal storage.]] +error occurs within the thread library. Any exception thrown whilst copying `func` into internal storage.\n +内存分配失败抛出 `std::bad_alloc` 异常, 如果线程库内部出错抛出 __thread_resource_error__ 异常。
+如果拷贝 `func` 过程出错,抛出其它异常。]]

 [[Note:] [This function is *not* called if the thread was terminated
 forcefully using platform-specific APIs, or if the thread is
 terminated due to a call to `exit()`, `abort()` or
 `std::terminate()`. In particular, returning from `main()` is
 equivalent to call to `exit()`, so will not call any functions
-registered with `at_thread_exit()`]]
+registered with `at_thread_exit()`\n
+如果线程是通过平台特定的API被强行中止的,或者线程是由于对 `exit()`, `abort()` 或 `std::terminate()` 的调用而中止的, +则该函数*不会*被调用。特别地,从 `main()` 返回等同于调用 `exit()`,所以也不 会调用任何用 `at_thread_exit()` 登记的函数。]]

 ]

@@ -950,27 +1082,31 @@
     };

`thread_group` provides for a collection of threads that are related in some fashion. New threads can be added to the group with -`add_thread` and `create_thread` member functions. `thread_group` is not copyable or movable.
-
-[section:constructor Constructor]
+`add_thread` and `create_thread` member functions. `thread_group` is not copyable or movable.\n +`thread_group` 提供一组类似线程对象的集合。新的线程对象可以通过函数 `add_thread` 和 `create_thread` 加入到这个集合。
+`thread_group` 对象不支持拷贝和转移语义。
+
+[section:constructor Constructor 构造函数]

     thread_group();

 [variablelist

-[[Effects:] [Create a new thread group with no threads.]]
+[[Effects:] [Create a new thread group with no threads.\n
+创建一个线程组,不包含任何线程对象。]]

 ]

 [endsect]

-[section:destructor Destructor]
+[section:destructor Destructor 析构函数]

     ~thread_group();

 [variablelist

-[[Effects:] [Destroy `*this` and `delete` all __thread__ objects in the group.]] +[[Effects:] [Destroy `*this` and `delete` all __thread__ objects in the group.\n
+销毁 `*this`,`delete` 组内的所有 __thread__ 对象。]]

 ]

@@ -983,11 +1119,14 @@

 [variablelist

-[[Effects:] [Create a new __thread__ object as-if by `new thread(threadfunc)` and add it to the group.]]
-
-[[Postcondition:] [`this->size()` is increased by one, the new thread is running.]]
-
-[[Returns:] [A pointer to the new __thread__ object.]]
+[[Effects:] [Create a new __thread__ object as-if by `new thread(threadfunc)` and add it to the group.\n +象 `new thread(threadfunc)` 那样创建一个新的 __thread__ 对象,将它添加到该 组。]]
+
+[[Postcondition:] [`this->size()` is increased by one, the new thread is running.\n
+属性 `this->size()` 增加1, 新线程开始运行。]]
+
+[[Returns:] [A pointer to the new __thread__ object.\n
+新 __thread__ 对象的指针。]]

 ]

@@ -999,11 +1138,14 @@

 [variablelist

-[[Precondition:] [The expression `delete thrd` is well-formed and will not result in undefined behaviour.]]
-
-[[Effects:] [Take ownership of the __thread__ object pointed to by `thrd` and add it to the group.]]
-
-[[Postcondition:] [`this->size()` is increased by one.]]
+[[Precondition:] [The expression `delete thrd` is well-formed and will not result in undefined behaviour.\n
+表达式 `delete thrd` 有效且不会产生无定义行为。]]
+
+[[Effects:] [Take ownership of the __thread__ object pointed to by `thrd` and add it to the group.\n
+获得 `thrd` 所指向的 __thread__ 对象的拥有权,并将它添加到线程组。]]
+
+[[Postcondition:] [`this->size()` is increased by one.\n
+属性 `this->size()` 增加计数1。]]

 ]

@@ -1015,9 +1157,11 @@

 [variablelist

-[[Effects:] [If `thrd` is a member of the group, remove it without calling `delete`.]]
-
-[[Postcondition:] [If `thrd` was a member of the group, `this->size()` is decreased by one.]] +[[Effects:] [If `thrd` is a member of the group, remove it without calling `delete`.\n +如果 `thrd` 指向的对象属于该线程组, 将该对象从该组中移除,不调用 `delete`。 ]]
+
+[[Postcondition:] [If `thrd` was a member of the group, `this->size()` is decreased by one.\n
+如果 `thrd` 指向的对象属于该线程组, 属性 `this->size()` 减少计数1。 ]]

 ]

@@ -1029,11 +1173,14 @@

 [variablelist

-[[Effects:] [Call `join()` on each __thread__ object in the group.]]
-
-[[Postcondition:] [Every thread in the group has terminated.]]
-
-[[Note:] [Since __join__ is one of the predefined __interruption_points__, `join_all()` is also an interruption point.]]
+[[Effects:] [Call `join()` on each __thread__ object in the group.\n
+对组中每个 __thread__ 对象调用 `join()`。]]
+
+[[Postcondition:] [Every thread in the group has terminated.\n
+该组内所有线程结束。]]
+
+[[Note:] [Since __join__ is one of the predefined __interruption_points__, `join_all()` is also an interruption point.\n +由于 __join__ 是一个预定义的 __interruption_points__, 所以 `join_all()` 也 是一个中断点。]]

 ]

@@ -1045,7 +1192,8 @@

 [variablelist

-[[Effects:] [Call `interrupt()` on each __thread__ object in the group.]]
+[[Effects:] [Call `interrupt()` on each __thread__ object in the group.\n
+对该组内每个 __thread__ 对象调用 `interrupt()` 函数。]]

 ]
***The diff for this file has been truncated for email.***
=======================================
--- /trunk/libs/thread/doc/time.qbk     Mon Dec 28 23:05:14 2009
+++ /trunk/libs/thread/doc/time.qbk     Sun Feb  7 05:34:27 2010
@@ -5,10 +5,11 @@
   http://www.boost.org/LICENSE_1_0.txt).
 ]

-[section:time Date and Time Requirements]
+[section:time Date and Time Requirements  日期和时间相关]

As of Boost 1.35.0, the __boost_thread__ library uses the [link date_time Boost.Date_Time] library for all operations that require a
-time out. These include (but are not limited to):
+time out. These include (but are not limited to):\n
+在Boost 1.35.0,__boost_thread__ 库使用 [link date_time Boost.Date_Time] 库 提供超时处理。包括(但不限于):

 * __sleep__
 * __timed_join__
@@ -17,7 +18,9 @@

For the overloads that accept an absolute time parameter, an object of type [link thread.time.system_time `boost::system_time`] is required. Typically, this will be obtained by adding a duration to the current time, obtained with a call to [link
-thread.time.get_system_time `boost::get_system_time()`]. e.g.
+thread.time.get_system_time `boost::get_system_time()`]. e.g.\n
+对于那些接受完整时间做参数的函数,我们需要一个 [link thread.time.system_time `boost::system_time`] 对象。 +典型的,可以通过 `boost::get_system_time()` 得到当前时间,然后加上一个时间 段得到,比如:

boost::system_time const timeout=boost::get_system_time() + boost::posix_time::milliseconds(500);

@@ -35,7 +38,8 @@
     }

For the overloads that accept a ['TimeDuration] parameter, an object of any type that meets the [link -date_time.posix_time.time_duration Boost.Date_Time Time Duration requirements] can be used, e.g. +date_time.posix_time.time_duration Boost.Date_Time Time Duration requirements] can be used, e.g.\n +对于以['时间段]作为参数的函数,我们需要一个满足[link date_time.posix_time.time_duration Boost.Date_Time 时间段要求]的对象,比如:

     boost::this_thread::sleep(boost::posix_time::milliseconds(25));

@@ -51,7 +55,8 @@

     typedef boost::posix_time::ptime system_time;

-See the documentation for [link date_time.posix_time.ptime_class `boost::posix_time::ptime`] in the Boost.Date_Time library. +See the documentation for [link date_time.posix_time.ptime_class `boost::posix_time::ptime`] in the Boost.Date_Time library.\n +参考 Boost.Date_Time 库中的 [link date_time.posix_time.ptime_class `boost::posix_time::ptime`] 文档。

 [endsect]

@@ -63,9 +68,11 @@

 [variablelist

-[[Returns:] [The current time.]]
-
-[[Throws:] [Nothing.]]
+[[Returns:] [The current time.\n
+当前时间。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

=======================================
--- /trunk/libs/thread/doc/tss.qbk      Mon Dec 28 23:05:14 2009
+++ /trunk/libs/thread/doc/tss.qbk      Sun Feb  7 05:34:27 2010
@@ -5,33 +5,44 @@
   http://www.boost.org/LICENSE_1_0.txt).
 ]

-[section Thread Local Storage]
-
-[heading Synopsis]
+[section:thread_local_storage Thread Local Storage 线程局部存储]
+
+[heading Synopsis 概述]

Thread local storage allows multi-threaded applications to have a separate instance of a given data item for each thread. Where a single-threaded application would use static or global data, this could lead to contention, deadlock or data corruption in a multi-threaded application. One example is the C `errno` variable, used for storing the error code related to functions from the Standard C library. It is common practice (and required by POSIX) for compilers that support multi-threaded applications to provide -a separate instance of `errno` for each thread, in order to avoid different threads competing to read or update the value. +a separate instance of `errno` for each thread, in order to avoid different threads competing to read or update the value.\n +线程局部存储允许多个线程对象拥有特定数据的独立拷贝。 单线程程序通常使用的的 静态数据和全局数据在多线程程序中会引发访问竞争、死锁, +或者数据破坏。一个例子就是C运行库中的 `errno` 变量, 该变量用于存放C标准库中 函数的错误代码。对于支持多线程的编译器来说, +为每个线程提供一个独立的 `errno` 是常见的做法,以此避免多个线程竞争对它的访 问和更新(这也是POSIX标准要求的)。

Though compilers often provide this facility in the form of extensions to the declaration syntax (such as `__declspec(thread)` or `__thread` annotations on `static` or namespace-scope variable declarations), such support is non-portable, and is often limited in
-some way, such as only supporting POD types.
-
-[heading Portable thread-local storage with `boost::thread_specific_ptr`]
+some way, such as only supporting POD types.\n
+尽管编译器通常提供一些形式的语法扩展来方便标记线程局部存储(比如用于 `static` 或名字空间内变量声明前的 `__declspec(thread)` +或 `__thread` 标记), 但是这些支持是不可移植的, 也仅限于某些用途, 比如只支 持 POD 类型。
+
+[heading Portable thread-local storage with `boost::thread_specific_ptr` 由 `boost::thread_specific_ptr`实现的可移植的线程本地化存储]

`boost::thread_specific_ptr` provides a portable mechanism for thread-local storage that works on all compilers supported by __boost_thread__. Each instance of `boost::thread_specific_ptr` represents a pointer to an object (such as `errno`) where each thread must have a distinct value. The value for the current thread can be obtained using the `get()` member function, or by using the `*` and `->` pointer deference operators. Initially the pointer has a value of `NULL` in each thread, but the value for the
-current thread can be set using the `reset()` member function.
+current thread can be set using the `reset()` member function.\n
+`boost::thread_specific_ptr` 提供了一个线程本地化存储机制的可移植实现,在支 持 __boost_thread__ 的所有平台上适用。 +每个 `boost::thread_specific_ptr` 实例表示指向一个对象(比如 `errno`)的指 针,这些对象要求在不同的线程间有不同的值。 +当前线程对应的对象的值可以通过成员函数 `get()` 成员函数来获取,或是通过 `*` 和 `->` 指针提领操作符。在每个线程中, +这些对象的初始值为 `NULL`,而当前线程的值可以通过 `reset()` 成员函数来设 置。

If the value of the pointer for the current thread is changed using `reset()`, then the previous value is destroyed by calling the cleanup routine. Alternatively, the stored value can be reset to `NULL` and the prior value returned by calling the `release()` -member function, allowing the application to take back responsibility for destroying the object.
-
-[heading Cleanup at thread exit]
+member function, allowing the application to take back responsibility for destroying the object.\n +如果通过 `reset()` 修改了当前线程的指针值,那么在此之前的值会被清理。另外, 存储的值可以通过成员函数 `release()` 置为 `NULL`,
+该函数同时返回先前值, 这样应用程序可以有机会销毁这个值关联的对象。
+
+[heading Cleanup at thread exit 线程退出时清理]

When a thread exits, the objects associated with each `boost::thread_specific_ptr` instance are destroyed. By default, the object pointed to by a pointer `p` is destroyed by invoking `delete p`, but this can be overridden for a specific instance of
@@ -39,7 +50,11 @@
`func(p)` where `func` is the cleanup routine supplied to the constructor. The cleanup functions are called in an unspecified order. If a cleanup routine sets the value of associated with an instance of `boost::thread_specific_ptr` that has already been cleaned up, that value is added to the cleanup list. Cleanup finishes when there are no outstanding instances of
-`boost::thread_specific_ptr` with values.
+`boost::thread_specific_ptr` with values.\n
+当一个线程退出, `boost::thread_specific_ptr` 实例所关联的对象会被销毁。缺省 情况下,指针 `p` 所指向的对象通过调用 `delete p` 来销毁, +不过这个行为也可以通过向 `boost::thread_specific_ptr` 对象构造时传递一个清 理函数 `func()` 来覆写。此时, 通过调用 `func(p)` 来销毁对象, +其中 `func` 为提供给构造函数的清理函数。这些清理函数的调用顺序是不确定的。 如果一个清理函数将一个 `boost::thread_specific_ptr` +实例所关联的值设置为已被清理, 这个值会被添加到清理列表中。当所有 `boost::thread_specific_ptr` 对象被置为空时,清理过程结束。


 [section:thread_specific_ptr Class `thread_specific_ptr`]
@@ -66,13 +81,17 @@

 [variablelist

-[[Requires:] [`delete this->get()` is well-formed.]]
+[[Requires:] [`delete this->get()` is well-formed.\n
+`delete this->get()` 有意义。]]

[[Effects:] [Construct a `thread_specific_ptr` object for storing a pointer to an object of type `T` specific to each thread. The default `delete`-based cleanup function will be used to destroy any thread-local objects when `reset()` is called, or the thread
-exits.]]
-
-[[Throws:] [`boost::thread_resource_error` if an error occurs.]]
+exits.\n
+构造一个 `thread_specific_ptr` 对象,存储一个 `T` 类型的指针,指向线程局部 对象。在函数 `reset()` 被调用, 或者线程退出时,
+默认基于 `delete` 的清理函数会被调用来销毁线程本地的对象。]]
+
+[[Throws:] [`boost::thread_resource_error` if an error occurs.\n
+如果出错,抛出 `boost::thread_resource_error` 异常。]]

 ]

@@ -82,12 +101,16 @@

 [variablelist

-[[Requires:] [`cleanup_function(this->get())` does not throw any exceptions.]] +[[Requires:] [`cleanup_function(this->get())` does not throw any exceptions.\n
+`cleanup_function(this->get())` 调用不抛出异常。]]

[[Effects:] [Construct a `thread_specific_ptr` object for storing a pointer to an object of type `T` specific to each thread. The -supplied `cleanup_function` will be used to destroy any thread-local objects when `reset()` is called, or the thread exits.]]
-
-[[Throws:] [`boost::thread_resource_error` if an error occurs.]]
+supplied `cleanup_function` will be used to destroy any thread-local objects when `reset()` is called, or the thread exits.\n +构造一个 `thread_specific_ptr` 对象,存储一个T类型的指针,指向线程局部对 象。在函数 `reset()` 被调用, 或者线程退出时,
+基于 `cleanup_function` 的清理函数会被调用来销毁线程本地的对象.]]
+
+[[Throws:] [`boost::thread_resource_error` if an error occurs.\n
+如果出错,抛出 `boost::thread_resource_error` 异常。]]

 ]

@@ -97,14 +120,19 @@

 [variablelist

-[[Effects:] [Calls `this->reset()` to clean up the associated value for the current thread, and destroys `*this`.]]
-
-[[Throws:] [Nothing.]]
+[[Effects:] [Calls `this->reset()` to clean up the associated value for the current thread, and destroys `*this`.\n
+调用函数 `this->reset()` 清理当前线程相关本地存储对象, 并销毁 `*this`。
+
+]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

[note Care needs to be taken to ensure that any threads still running after an instance of `boost::thread_specific_ptr` has been
-destroyed do not call any member functions on that instance.]
+destroyed do not call any member functions on that instance.\n
+必须小心确保 `boost::thread_specific_ptr` 对象销毁后,线程不再调用该对象的 函数。]

 [endsect]

@@ -112,13 +140,16 @@

 [variablelist

-[[Returns:] [The pointer associated with the current thread.]]
-
-[[Throws:] [Nothing.]]
+[[Returns:] [The pointer associated with the current thread.\n
+当前线程相关本地存储对象的指针。]]
+
+[[Throws:] [Nothing.\n
+无。]]

 ]

-[note The initial value associated with an instance of `boost::thread_specific_ptr` is `NULL` for each thread.] +[note The initial value associated with an instance of `boost::thread_specific_ptr` is `NULL` for each thread.\n
+对于每个线程,和 `boost::thread_specific_ptr` 关联对象初始值为 `NULL`。]

 [endsect]

@@ -128,7 +159,8 @@

 [[Returns:] [`this->get()`]]

-[[Throws:] [Nothing.]]
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -138,11 +170,13 @@

 [variablelist

-[[Requires:] [`this->get` is not `NULL`.]]
+[[Requires:] [`this->get` is not `NULL`.\n
+`this->get` 不为 `NULL`。]]

 [[Returns:] [`*(this->get())`]]

-[[Throws:] [Nothing.]]
+[[Throws:] [Nothing.\n
+无。]]

 ]

@@ -153,11 +187,14 @@
 [variablelist

[[Effects:] [If `this->get()!=new_value` and `this->get()` is non-`NULL`, invoke `delete this->get()` or -`cleanup_function(this->get())` as appropriate. Store `new_value` as the pointer associated with the current thread.]] +`cleanup_function(this->get())` as appropriate. Store `new_value` as the pointer associated with the current thread.\n +如果 `this->get()!=new_value` 并且 `this->get()` 为非 `NULL`, 调用相应的 `delete this->get()` 或者 `cleanup_function(this->get())`。
+将 `new_value` 保存为和当前线程关联的指针。]]

 [[Postcondition:] [`this->get()==new_value`]]

-[[Throws:] [`boost::thread_resource_error` if an error occurs.]]
+[[Throws:] [`boost::thread_resource_error` if an error occurs.\n
+如果出错,抛出 `boost::thread_resource_error` 异常。]]

 ]

@@ -168,11 +205,13 @@
 [variablelist

[[Effects:] [Return `this->get()` and store `NULL` as the pointer associated with the current thread without invoking the cleanup
-function.]]
+function.\n
+返回 `this->get()`,将当前线程关联的指针置为 `NULL`,不调用清理函数。]]

 [[Postcondition:] [`this->get()==0`]]

-[[Throws:] [Nothing.]]
+[[Throws:] [Nothing.\n
+无。]]

 ]

Other related posts:

  • » [boost-doc-zh] r372 committed - 翻译 static_assert, string_algo, thread 库的xml/qbk文件 - boost-doc-zh