File: classGlib_1_1Threads_1_1Thread.html

package info (click to toggle)
glibmm2.4 2.42.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 53,308 kB
  • ctags: 14,868
  • sloc: xml: 108,462; cpp: 15,282; sh: 11,421; perl: 5,139; python: 1,626; makefile: 304
file content (339 lines) | stat: -rw-r--r-- 24,531 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.7"/>
<title>glibmm: Glib::Threads::Thread Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">glibmm
   &#160;<span id="projectnumber">2.42.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.7 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceGlib.html">Glib</a></li><li class="navelem"><a class="el" href="namespaceGlib_1_1Threads.html">Threads</a></li><li class="navelem"><a class="el" href="classGlib_1_1Threads_1_1Thread.html">Thread</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="#related">Related Functions</a> &#124;
<a href="classGlib_1_1Threads_1_1Thread-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Glib::Threads::Thread Class Reference<div class="ingroups"><a class="el" href="group__Threads.html">Threads</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>Represents a running thread.  
 <a href="classGlib_1_1Threads_1_1Thread.html#details">More...</a></p>

<p><code>#include &lt;glibmm/threads.h&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Threads_1_1Thread_1_1Exit.html">Exit</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Exception class used to exit from a thread.  <a href="classGlib_1_1Threads_1_1Thread_1_1Exit.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ad68ccd7d8209913f09f742aef95758e1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Threads_1_1Thread.html#ad68ccd7d8209913f09f742aef95758e1">join</a> ()</td></tr>
<tr class="memdesc:ad68ccd7d8209913f09f742aef95758e1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Waits until the thread finishes.  <a href="#ad68ccd7d8209913f09f742aef95758e1">More...</a><br /></td></tr>
<tr class="separator:ad68ccd7d8209913f09f742aef95758e1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae2afcdad184e8064ab21edcb287e50d3"><td class="memItemLeft" align="right" valign="top">GThread*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Threads_1_1Thread.html#ae2afcdad184e8064ab21edcb287e50d3">gobj</a> ()</td></tr>
<tr class="separator:ae2afcdad184e8064ab21edcb287e50d3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a36d0432f001070d70cc52946b9e797f7"><td class="memItemLeft" align="right" valign="top">const GThread*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Threads_1_1Thread.html#a36d0432f001070d70cc52946b9e797f7">gobj</a> () const </td></tr>
<tr class="separator:a36d0432f001070d70cc52946b9e797f7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:ad89d142f0a9fd02d476dbed49dd17b85"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classGlib_1_1Threads_1_1Thread.html">Thread</a>*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Threads_1_1Thread.html#ad89d142f0a9fd02d476dbed49dd17b85">create</a> (const <a class="elRef" doxygen="/opt/gnome/share/doc/libsigc++-2.0/reference/libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/classsigc_1_1slot.html">sigc::slot</a>&lt; void &gt;&amp; slot)</td></tr>
<tr class="memdesc:ad89d142f0a9fd02d476dbed49dd17b85"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new thread.  <a href="#ad89d142f0a9fd02d476dbed49dd17b85">More...</a><br /></td></tr>
<tr class="separator:ad89d142f0a9fd02d476dbed49dd17b85"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2ffdf8dd86ea405669f610c7d47c90e9"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classGlib_1_1Threads_1_1Thread.html">Thread</a>*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Threads_1_1Thread.html#a2ffdf8dd86ea405669f610c7d47c90e9">create</a> (const <a class="elRef" doxygen="/opt/gnome/share/doc/libsigc++-2.0/reference/libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/classsigc_1_1slot.html">sigc::slot</a>&lt; void &gt;&amp; slot, const <a class="elRef" doxygen="/opt/gnome/share/mm-common/doctags/libstdc++.tag:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01681.html#ga32db3d9898c44d3b3a578b560f7758cc">std::string</a>&amp; name)</td></tr>
<tr class="memdesc:a2ffdf8dd86ea405669f610c7d47c90e9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new named thread.  <a href="#a2ffdf8dd86ea405669f610c7d47c90e9">More...</a><br /></td></tr>
<tr class="separator:a2ffdf8dd86ea405669f610c7d47c90e9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7289f43e01199fa1cf7df67f725f8cef"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classGlib_1_1Threads_1_1Thread.html">Thread</a>*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Threads_1_1Thread.html#a7289f43e01199fa1cf7df67f725f8cef">self</a> ()</td></tr>
<tr class="memdesc:a7289f43e01199fa1cf7df67f725f8cef"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the Thread* corresponding to the calling thread.  <a href="#a7289f43e01199fa1cf7df67f725f8cef">More...</a><br /></td></tr>
<tr class="separator:a7289f43e01199fa1cf7df67f725f8cef"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0b4e6d3fe278429716f0e0cca3654fde"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Threads_1_1Thread.html#a0b4e6d3fe278429716f0e0cca3654fde">yield</a> ()</td></tr>
<tr class="memdesc:a0b4e6d3fe278429716f0e0cca3654fde"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gives way to other threads waiting to be scheduled.  <a href="#a0b4e6d3fe278429716f0e0cca3654fde">More...</a><br /></td></tr>
<tr class="separator:a0b4e6d3fe278429716f0e0cca3654fde"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="related"></a>
Related Functions</h2></td></tr>
<tr><td class="ititle" colspan="2"><p>(Note that these are not member functions.) </p>
</td></tr>
<tr class="memitem:ga6bfbb3119eaac9fa8cb725aa1e82f61e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classGlib_1_1Threads_1_1Thread.html">Thread</a>*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__Threads.html#ga6bfbb3119eaac9fa8cb725aa1e82f61e">wrap</a> (GThread* gobject)</td></tr>
<tr class="separator:ga6bfbb3119eaac9fa8cb725aa1e82f61e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Represents a running thread. </p>
<p>An instance of this class can only be obtained with <a class="el" href="classGlib_1_1Threads_1_1Thread.html#ad89d142f0a9fd02d476dbed49dd17b85" title="Creates a new thread. ">create()</a>, <a class="el" href="classGlib_1_1Threads_1_1Thread.html#a7289f43e01199fa1cf7df67f725f8cef" title="Returns the Thread* corresponding to the calling thread. ">self()</a>, or <a class="el" href="group__Threads.html#ga6bfbb3119eaac9fa8cb725aa1e82f61e">wrap(GThread*)</a>. It's not possible to delete a <a class="el" href="classGlib_1_1Threads_1_1Thread.html" title="Represents a running thread. ">Thread</a> object. You must call <a class="el" href="classGlib_1_1Threads_1_1Thread.html#ad68ccd7d8209913f09f742aef95758e1" title="Waits until the thread finishes. ">join()</a> to avoid a memory leak.</p>
<dl class="section note"><dt>Note</dt><dd>g_thread_exit() is not wrapped, because that function exits a thread without any cleanup. That's especially dangerous in C++ code, since the destructors of automatic objects won't be invoked. Instead, you can throw a <a class="el" href="classGlib_1_1Threads_1_1Thread_1_1Exit.html" title="Exception class used to exit from a thread. ">Threads::Thread::Exit</a> exception, which will be caught by the internal thread entry function.</dd>
<dd>
You might have noticed that the thread entry slot doesn't have the usual void* return value. If you want to return any data from your thread you can pass an additional output argument to the thread's entry slot. </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="thread_2dispatcher_8cc-example.html#_a2">thread/dispatcher.cc</a>, and <a class="el" href="thread_2thread_8cc-example.html#_a11">thread/thread.cc</a>.</dd>
</dl></div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="ad89d142f0a9fd02d476dbed49dd17b85"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classGlib_1_1Threads_1_1Thread.html">Thread</a>* Glib::Threads::Thread::create </td>
          <td>(</td>
          <td class="paramtype">const <a class="elRef" doxygen="/opt/gnome/share/doc/libsigc++-2.0/reference/libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/classsigc_1_1slot.html">sigc::slot</a>&lt; void &gt; &amp;&#160;</td>
          <td class="paramname"><em>slot</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Creates a new thread. </p>
<p>You can wait for this thread's termination by calling <a class="el" href="classGlib_1_1Threads_1_1Thread.html#ad68ccd7d8209913f09f742aef95758e1" title="Waits until the thread finishes. ">join()</a>.</p>
<p>The new thread executes the function or method <em>slot</em> points to. You can pass additional arguments using <a class="elRef" doxygen="/opt/gnome/share/doc/libsigc++-2.0/reference/libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/group__bind.html#ga2f099bc6056b32f2a58134ba8537c6f4">sigc::bind()</a>. If the thread was created successfully, it is returned, otherwise a <a class="el" href="classGlib_1_1Threads_1_1ThreadError.html" title="Exception class for thread-related errors. ">Threads::ThreadError</a> exception is thrown.</p>
<p>Because <a class="elRef" doxygen="/opt/gnome/share/doc/libsigc++-2.0/reference/libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/structsigc_1_1trackable.html">sigc::trackable</a> is not thread-safe, if the slot represents a non-static class method and is created by <a class="elRef" doxygen="/opt/gnome/share/doc/libsigc++-2.0/reference/libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/group__mem__fun.html#gadf6b6d22c503b439019f0a2e77352419">sigc::mem_fun()</a>, the class concerned should not derive from <a class="elRef" doxygen="/opt/gnome/share/doc/libsigc++-2.0/reference/libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/structsigc_1_1trackable.html">sigc::trackable</a>. You can use, say, boost::bind() or, in C++11, <a class="elRef" doxygen="/opt/gnome/share/mm-common/doctags/libstdc++.tag:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01682.html#ga4c3052b337dde285bace96cbb996055c">std::bind()</a> or a C++11 lambda expression instead of <a class="elRef" doxygen="/opt/gnome/share/doc/libsigc++-2.0/reference/libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/group__mem__fun.html#gadf6b6d22c503b439019f0a2e77352419">sigc::mem_fun()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slot</td><td>A slot to execute in the new thread. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The new Thread* on success. </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="classGlib_1_1Threads_1_1ThreadError.html" title="Exception class for thread-related errors. ">Glib::Threads::ThreadError</a></td><td></td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="thread_2dispatcher_8cc-example.html#a9">thread/dispatcher.cc</a>, and <a class="el" href="thread_2thread_8cc-example.html#a12">thread/thread.cc</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="a2ffdf8dd86ea405669f610c7d47c90e9"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classGlib_1_1Threads_1_1Thread.html">Thread</a>* Glib::Threads::Thread::create </td>
          <td>(</td>
          <td class="paramtype">const <a class="elRef" doxygen="/opt/gnome/share/doc/libsigc++-2.0/reference/libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/classsigc_1_1slot.html">sigc::slot</a>&lt; void &gt; &amp;&#160;</td>
          <td class="paramname"><em>slot</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="elRef" doxygen="/opt/gnome/share/mm-common/doctags/libstdc++.tag:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01681.html#ga32db3d9898c44d3b3a578b560f7758cc">std::string</a> &amp;&#160;</td>
          <td class="paramname"><em>name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Creates a new named thread. </p>
<p>You can wait for this thread's termination by calling <a class="el" href="classGlib_1_1Threads_1_1Thread.html#ad68ccd7d8209913f09f742aef95758e1" title="Waits until the thread finishes. ">join()</a>.</p>
<p>The new thread executes the function or method <em>slot</em> points to. You can pass additional arguments using <a class="elRef" doxygen="/opt/gnome/share/doc/libsigc++-2.0/reference/libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/group__bind.html#ga2f099bc6056b32f2a58134ba8537c6f4">sigc::bind()</a>. If the thread was created successfully, it is returned, otherwise a <a class="el" href="classGlib_1_1Threads_1_1ThreadError.html" title="Exception class for thread-related errors. ">Threads::ThreadError</a> exception is thrown.</p>
<p>Because <a class="elRef" doxygen="/opt/gnome/share/doc/libsigc++-2.0/reference/libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/structsigc_1_1trackable.html">sigc::trackable</a> is not thread-safe, if the slot represents a non-static class method and is created by <a class="elRef" doxygen="/opt/gnome/share/doc/libsigc++-2.0/reference/libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/group__mem__fun.html#gadf6b6d22c503b439019f0a2e77352419">sigc::mem_fun()</a>, the class concerned should not derive from <a class="elRef" doxygen="/opt/gnome/share/doc/libsigc++-2.0/reference/libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/structsigc_1_1trackable.html">sigc::trackable</a>. You can use, say, boost::bind() or, in C++11, <a class="elRef" doxygen="/opt/gnome/share/mm-common/doctags/libstdc++.tag:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01682.html#ga4c3052b337dde285bace96cbb996055c">std::bind()</a> or a C++11 lambda expression instead of <a class="elRef" doxygen="/opt/gnome/share/doc/libsigc++-2.0/reference/libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/group__mem__fun.html#gadf6b6d22c503b439019f0a2e77352419">sigc::mem_fun()</a>.</p>
<p>The <em>name</em> can be useful for discriminating threads in a debugger. It is not used for other purposes and does not have to be unique. Some systems restrict the length of <em>name</em> to 16 bytes.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slot</td><td>A slot to execute in the new thread. </td></tr>
    <tr><td class="paramname">name</td><td>A name for the new thread. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The new Thread* on success. </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="classGlib_1_1Threads_1_1ThreadError.html" title="Exception class for thread-related errors. ">Glib::Threads::ThreadError</a></td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="since_2_36"><dt><b><a class="el" href="since_2_36.html#_since_2_36000005">Since glibmm 2.36:</a></b></dt><dd></dd></dl>

</div>
</div>
<a class="anchor" id="ae2afcdad184e8064ab21edcb287e50d3"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">GThread* Glib::Threads::Thread::gobj </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a36d0432f001070d70cc52946b9e797f7"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const GThread* Glib::Threads::Thread::gobj </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="ad68ccd7d8209913f09f742aef95758e1"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Glib::Threads::Thread::join </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Waits until the thread finishes. </p>
<p>Waits until the thread finishes, i.e. the slot, as given to <a class="el" href="classGlib_1_1Threads_1_1Thread.html#ad89d142f0a9fd02d476dbed49dd17b85" title="Creates a new thread. ">create()</a>, returns or g_thread_exit() is called by the thread. (Calling g_thread_exit() in a C++ program should be avoided.) All resources of the thread including the <a class="el" href="classGlib_1_1Threads_1_1Thread.html" title="Represents a running thread. ">Glib::Threads::Thread</a> object are released. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="thread_2thread_8cc-example.html#a14">thread/thread.cc</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="a7289f43e01199fa1cf7df67f725f8cef"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classGlib_1_1Threads_1_1Thread.html">Thread</a>* Glib::Threads::Thread::self </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns the Thread* corresponding to the calling thread. </p>
<dl class="section return"><dt>Returns</dt><dd>The current thread. </dd></dl>

</div>
</div>
<a class="anchor" id="a0b4e6d3fe278429716f0e0cca3654fde"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void Glib::Threads::Thread::yield </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Gives way to other threads waiting to be scheduled. </p>
<p>This function is often used as a method to make busy wait less evil. But in most cases, you will encounter, there are better methods to do that. So in general you shouldn't use this function. </p>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon Sep 22 2014 21:38:34 for glibmm by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.7
</small></address>
</body>
</html>