1 | <html> |
---|
2 | <head> |
---|
3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
---|
4 | <title>Class thread_group</title> |
---|
5 | <link rel="stylesheet" href="boostbook.css" type="text/css"> |
---|
6 | <meta name="generator" content="DocBook XSL Stylesheets V1.69.1"> |
---|
7 | <link rel="start" href="index.html" title="The Boost C++ Libraries"> |
---|
8 | <link rel="up" href="threads/reference.html#id2617127" title="Header <boost/thread/thread.hpp>"> |
---|
9 | <link rel="prev" href="thread.html" title="Class thread"> |
---|
10 | <link rel="next" href="thread_specific_ptr.html" title="Class thread_specific_ptr"> |
---|
11 | </head> |
---|
12 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
---|
13 | <table cellpadding="2" width="100%"> |
---|
14 | <td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../boost.png"></td> |
---|
15 | <td align="center"><a href="../../index.htm">Home</a></td> |
---|
16 | <td align="center"><a href="../../libs/libraries.htm">Libraries</a></td> |
---|
17 | <td align="center"><a href="../../people/people.htm">People</a></td> |
---|
18 | <td align="center"><a href="../../more/faq.htm">FAQ</a></td> |
---|
19 | <td align="center"><a href="../../more/index.htm">More</a></td> |
---|
20 | </table> |
---|
21 | <hr> |
---|
22 | <div class="spirit-nav"> |
---|
23 | <a accesskey="p" href="thread.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="threads/reference.html#id2617127"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="thread_specific_ptr.html"><img src="images/next.png" alt="Next"></a> |
---|
24 | </div> |
---|
25 | <div class="refentry" lang="en"> |
---|
26 | <a name="thread_group"></a><div class="titlepage"></div> |
---|
27 | <div class="refnamediv"> |
---|
28 | <h2><span class="refentrytitle">Class thread_group</span></h2> |
---|
29 | <p>boost::thread_group — |
---|
30 | The <a href="thread_group.html" title="Class thread_group">thread_group</a> class provides a container |
---|
31 | for easy grouping of threads to simplify several common thread |
---|
32 | creation and management idioms. |
---|
33 | </p> |
---|
34 | </div> |
---|
35 | <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> |
---|
36 | <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"> |
---|
37 | <span class="bold"><strong>class</strong></span> thread_group : <span class="bold"><strong>private</strong></span> boost::noncopyable <span class="emphasis"><em>// Exposition only</em></span> |
---|
38 | { |
---|
39 | <span class="bold"><strong>public</strong></span>: |
---|
40 | <span class="emphasis"><em>// <a href="thread_group.html#thread_groupconstruct-copy-destruct">construct/copy/destruct</a></em></span> |
---|
41 | <a href="thread_group.html#id2531266-bb">thread_group</a>(); |
---|
42 | <a href="thread_group.html#id2605650-bb">~thread_group</a>(); |
---|
43 | |
---|
44 | <span class="emphasis"><em>// <a href="thread_group.html#id2450255-bb">modifier</a></em></span> |
---|
45 | <span class="type"><a href="thread.html" title="Class thread">thread</a>*</span> <a href="thread_group.html#id2561946-bb">create_thread</a>(<span class="bold"><strong>const</strong></span> boost::function0<<span class="bold"><strong>void</strong></span>>&); |
---|
46 | <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="thread_group.html#id2584425-bb">add_thread</a>(<a href="thread.html" title="Class thread">thread</a>* thrd); |
---|
47 | <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="thread_group.html#id2486169-bb">remove_thread</a>(<a href="thread.html" title="Class thread">thread</a>* thrd); |
---|
48 | <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="thread_group.html#id2626351-bb">join_all</a>(); |
---|
49 | };</pre></div> |
---|
50 | <div class="refsect1" lang="en"> |
---|
51 | <a name="id2784910"></a><h2>Description</h2> |
---|
52 | <div class="refsect2" lang="en"> |
---|
53 | <a name="id2784913"></a><h3> |
---|
54 | <a name="thread_groupconstruct-copy-destruct"></a><code class="computeroutput">thread_group</code> construct/copy/destruct</h3> |
---|
55 | <div class="orderedlist"><ol type="1"> |
---|
56 | <li> |
---|
57 | <pre class="literallayout"><a name="id2531266-bb"></a>thread_group();</pre> |
---|
58 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>: |
---|
59 | |
---|
60 | Constructs an empty <a href="thread_group.html" title="Class thread_group">thread_group</a> |
---|
61 | container.</p> |
---|
62 | </li> |
---|
63 | <li> |
---|
64 | <pre class="literallayout"><a name="id2605650-bb"></a>~thread_group();</pre> |
---|
65 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>: |
---|
66 | |
---|
67 | Destroys each contained thread object. Destroys <code class="computeroutput">*this</code>.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Notes</span></b>: |
---|
68 | |
---|
69 | Behavior is undefined if another thread references |
---|
70 | <code class="computeroutput">*this </code> during the execution of the destructor. |
---|
71 | </p> |
---|
72 | </li> |
---|
73 | </ol></div> |
---|
74 | </div> |
---|
75 | <div class="refsect2" lang="en"> |
---|
76 | <a name="id2785006"></a><h3> |
---|
77 | <a name="id2450255-bb"></a><code class="computeroutput">thread_group</code> modifier</h3> |
---|
78 | <div class="orderedlist"><ol type="1"> |
---|
79 | <li> |
---|
80 | <pre class="literallayout"><span class="type"><a href="thread.html" title="Class thread">thread</a>*</span> <a name="id2561946-bb"></a>create_thread(<span class="bold"><strong>const</strong></span> boost::function0<<span class="bold"><strong>void</strong></span>>& threadfunc);</pre> |
---|
81 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>: |
---|
82 | |
---|
83 | Creates a new <a href="thread.html" title="Class thread">thread</a> object |
---|
84 | that executes <code class="computeroutput">threadfunc</code> and adds it to the |
---|
85 | <code class="computeroutput">thread_group</code> container object's list of managed |
---|
86 | <a href="thread.html" title="Class thread">thread</a> objects.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>: |
---|
87 | |
---|
88 | Pointer to the newly created |
---|
89 | <a href="thread.html" title="Class thread">thread</a> object.</p> |
---|
90 | </li> |
---|
91 | <li> |
---|
92 | <pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id2584425-bb"></a>add_thread(<a href="thread.html" title="Class thread">thread</a>* thrd);</pre> |
---|
93 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>: |
---|
94 | |
---|
95 | Adds <code class="computeroutput">thrd</code> to the |
---|
96 | <a href="thread_group.html" title="Class thread_group">thread_group</a> object's list of managed |
---|
97 | <a href="thread.html" title="Class thread">thread</a> objects. The <code class="computeroutput">thrd</code> |
---|
98 | object must have been allocated via <code class="computeroutput">operator new</code> and will |
---|
99 | be deleted when the group is destroyed.</p> |
---|
100 | </li> |
---|
101 | <li> |
---|
102 | <pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id2486169-bb"></a>remove_thread(<a href="thread.html" title="Class thread">thread</a>* thrd);</pre> |
---|
103 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>: |
---|
104 | |
---|
105 | Removes <code class="computeroutput">thread</code> from <code class="computeroutput">*this</code>'s |
---|
106 | list of managed <a href="thread.html" title="Class thread">thread</a> objects.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>: |
---|
107 | |
---|
108 | <span class="bold"><strong>???</strong></span> if |
---|
109 | <code class="computeroutput">thrd</code> is not in <code class="computeroutput">*this</code>'s list |
---|
110 | of managed <a href="thread.html" title="Class thread">thread</a> objects.</p> |
---|
111 | </li> |
---|
112 | <li> |
---|
113 | <pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id2626351-bb"></a>join_all();</pre> |
---|
114 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>: |
---|
115 | |
---|
116 | Calls <code class="computeroutput">join()</code> on each of the managed |
---|
117 | <a href="thread.html" title="Class thread">thread</a> objects.</p> |
---|
118 | </li> |
---|
119 | </ol></div> |
---|
120 | </div> |
---|
121 | </div> |
---|
122 | </div> |
---|
123 | <table width="100%"><tr> |
---|
124 | <td align="left"></td> |
---|
125 | <td align="right"><small>Copyright © 2001-2003 William E. Kempf</small></td> |
---|
126 | </tr></table> |
---|
127 | <hr> |
---|
128 | <div class="spirit-nav"> |
---|
129 | <a accesskey="p" href="thread.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="threads/reference.html#id2617127"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="thread_specific_ptr.html"><img src="images/next.png" alt="Next"></a> |
---|
130 | </div> |
---|
131 | </body> |
---|
132 | </html> |
---|