File: classGlib_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 (471 lines) | stat: -rw-r--r-- 31,857 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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
<!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::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="classGlib_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_1Thread-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Glib::Thread Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

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

<p><code>#include &lt;glibmm/thread.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_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_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:ab95e51699279fd84c9577c45d76b0d8e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#ab95e51699279fd84c9577c45d76b0d8e">join</a> ()</td></tr>
<tr class="memdesc:ab95e51699279fd84c9577c45d76b0d8e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Waits until the thread finishes.  <a href="#ab95e51699279fd84c9577c45d76b0d8e">More...</a><br /></td></tr>
<tr class="separator:ab95e51699279fd84c9577c45d76b0d8e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9feee4b860d9928f86b9d255e2f2b133"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#a9feee4b860d9928f86b9d255e2f2b133">joinable</a> () const </td></tr>
<tr class="memdesc:a9feee4b860d9928f86b9d255e2f2b133"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns whether the thread is joinable.  <a href="#a9feee4b860d9928f86b9d255e2f2b133">More...</a><br /></td></tr>
<tr class="separator:a9feee4b860d9928f86b9d255e2f2b133"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3b323f981147d7eb4b4bd03f3fbdccf5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#a3b323f981147d7eb4b4bd03f3fbdccf5">set_priority</a> (<a class="el" href="group__glibmmEnums.html#ga9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a> priority)</td></tr>
<tr class="memdesc:a3b323f981147d7eb4b4bd03f3fbdccf5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Changes the priority of the thread to <em>priority</em>.  <a href="#a3b323f981147d7eb4b4bd03f3fbdccf5">More...</a><br /></td></tr>
<tr class="separator:a3b323f981147d7eb4b4bd03f3fbdccf5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a28d1bcf53d846b8b0d75b93178a614ab"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__glibmmEnums.html#ga9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#a28d1bcf53d846b8b0d75b93178a614ab">get_priority</a> () const </td></tr>
<tr class="memdesc:a28d1bcf53d846b8b0d75b93178a614ab"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the priority of the thread.  <a href="#a28d1bcf53d846b8b0d75b93178a614ab">More...</a><br /></td></tr>
<tr class="separator:a28d1bcf53d846b8b0d75b93178a614ab"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a28fbc6c46928a90d82114fa9b6b63196"><td class="memItemLeft" align="right" valign="top">GThread*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#a28fbc6c46928a90d82114fa9b6b63196">gobj</a> ()</td></tr>
<tr class="separator:a28fbc6c46928a90d82114fa9b6b63196"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a351fa5fb621a394e28037c4f50ab69ad"><td class="memItemLeft" align="right" valign="top">const GThread*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#a351fa5fb621a394e28037c4f50ab69ad">gobj</a> () const </td></tr>
<tr class="separator:a351fa5fb621a394e28037c4f50ab69ad"><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:a2775df2f24b6166e3fab41e69dcd04b6"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classGlib_1_1Thread.html">Thread</a>*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#a2775df2f24b6166e3fab41e69dcd04b6">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, bool <a class="el" href="classGlib_1_1Thread.html#a9feee4b860d9928f86b9d255e2f2b133">joinable</a>=true)</td></tr>
<tr class="memdesc:a2775df2f24b6166e3fab41e69dcd04b6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new thread with the priority <code>THREAD_PRIORITY_NORMAL</code>.  <a href="#a2775df2f24b6166e3fab41e69dcd04b6">More...</a><br /></td></tr>
<tr class="separator:a2775df2f24b6166e3fab41e69dcd04b6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9db6864c35701b1c179f48217ab76cca"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classGlib_1_1Thread.html">Thread</a>*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#a9db6864c35701b1c179f48217ab76cca">self</a> ()</td></tr>
<tr class="memdesc:a9db6864c35701b1c179f48217ab76cca"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the Thread* corresponding to the calling thread.  <a href="#a9db6864c35701b1c179f48217ab76cca">More...</a><br /></td></tr>
<tr class="separator:a9db6864c35701b1c179f48217ab76cca"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af30a7a8b037c7c7a3802aa2a22cf612d"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classGlib_1_1Thread.html">Thread</a>*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#af30a7a8b037c7c7a3802aa2a22cf612d">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, unsigned long stack_size, bool <a class="el" href="classGlib_1_1Thread.html#a9feee4b860d9928f86b9d255e2f2b133">joinable</a>, bool bound, <a class="el" href="group__glibmmEnums.html#ga9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a> priority)</td></tr>
<tr class="memdesc:af30a7a8b037c7c7a3802aa2a22cf612d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new thread with the priority <em>priority</em>.  <a href="#af30a7a8b037c7c7a3802aa2a22cf612d">More...</a><br /></td></tr>
<tr class="separator:af30a7a8b037c7c7a3802aa2a22cf612d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acad8be7a8093ef3aca32344264461011"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#acad8be7a8093ef3aca32344264461011">yield</a> ()</td></tr>
<tr class="memdesc:acad8be7a8093ef3aca32344264461011"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gives way to other threads waiting to be scheduled.  <a href="#acad8be7a8093ef3aca32344264461011">More...</a><br /></td></tr>
<tr class="separator:acad8be7a8093ef3aca32344264461011"><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:a6bfbb3119eaac9fa8cb725aa1e82f61e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classGlib_1_1Thread.html">Thread</a>*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#a6bfbb3119eaac9fa8cb725aa1e82f61e">wrap</a> (GThread* gobject)</td></tr>
<tr class="separator:a6bfbb3119eaac9fa8cb725aa1e82f61e"><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_1Thread.html#a2775df2f24b6166e3fab41e69dcd04b6" title="Creates a new thread with the priority THREAD_PRIORITY_NORMAL. ">create()</a>, <a class="el" href="classGlib_1_1Thread.html#a9db6864c35701b1c179f48217ab76cca" title="Returns the Thread* corresponding to the calling thread. ">self()</a>, or <a class="el" href="classGlib_1_1Thread.html#a6bfbb3119eaac9fa8cb725aa1e82f61e">wrap(GThread*)</a>. It's not possible to delete a <a class="el" href="classGlib_1_1Thread.html" title="Represents a running thread. ">Thread</a> object. If the thread is <em>not</em> joinable, its resources will be freed automatically when it exits. Otherwise, if the thread <em>is</em> joinable, you must call <a class="el" href="classGlib_1_1Thread.html#ab95e51699279fd84c9577c45d76b0d8e" 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_1Thread_1_1Exit.html" title="Exception class used to exit from a thread. ">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 class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000012">Deprecated:</a></b></dt><dd>Use <a class="el" href="classGlib_1_1Threads_1_1Thread.html" title="Represents a running thread. ">Glib::Threads::Thread</a> instead. </dd></dl>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a2775df2f24b6166e3fab41e69dcd04b6"></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_1Thread.html">Thread</a>* Glib::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">bool&#160;</td>
          <td class="paramname"><em>joinable</em> = <code>true</code>&#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 thread with the priority <code>THREAD_PRIORITY_NORMAL</code>. </p>
<p>If <em>joinable</em> is <code>true</code>, you can wait for this thread's termination by calling <a class="el" href="classGlib_1_1Thread.html#ab95e51699279fd84c9577c45d76b0d8e" title="Waits until the thread finishes. ">join()</a>. Otherwise the thread will just disappear, when ready.</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_1ThreadError.html" title="Exception class for thread-related errors. ">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 (that is, it 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>.</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">joinable</td><td>This parameter is now ignored because <a class="el" href="namespaceGlib_1_1Threads.html">Threads</a> are now always joinable. </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_1ThreadError.html" title="Exception class for thread-related errors. ">Glib::ThreadError</a></td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="af30a7a8b037c7c7a3802aa2a22cf612d"></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_1Thread.html">Thread</a>* Glib::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">unsigned long&#160;</td>
          <td class="paramname"><em>stack_size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>joinable</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>bound</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__glibmmEnums.html#ga9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a>&#160;</td>
          <td class="paramname"><em>priority</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 thread with the priority <em>priority</em>. </p>
<p>The stack gets the size <em>stack_size</em> or the default value for the current platform, if <em>stack_size</em> is <code>0</code>.</p>
<p>If <em>joinable</em> is <code>true</code>, you can wait for this thread's termination by calling <a class="el" href="classGlib_1_1Thread.html#ab95e51699279fd84c9577c45d76b0d8e" title="Waits until the thread finishes. ">join()</a>. Otherwise the thread will just disappear, when ready. If <em>bound</em> is <code>true</code>, this thread will be scheduled in the system scope, otherwise the implementation is free to do scheduling in the process scope. The first variant is more expensive resource-wise, but generally faster. On some systems (e.g. Linux) all threads are bound.</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.</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 (that is, it 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>.</p>
<dl class="section note"><dt>Note</dt><dd>It is not guaranteed, that threads with different priorities really behave accordingly. On some systems (e.g. Linux) only root can increase priorities. On other systems (e.g. Solaris) there doesn't seem to be different scheduling for different priorities. All in all try to avoid being dependent on priorities. Use <code><a class="el" href="namespaceGlib.html#ga9b87dca6496b6ad53baec9ca01318448a6216bb25baaaca32642841ade911a92e" title="The default priority. ">Glib::THREAD_PRIORITY_NORMAL</a></code> here as a default.</dd>
<dd>
Only use the extended <a class="el" href="classGlib_1_1Thread.html#af30a7a8b037c7c7a3802aa2a22cf612d" title="Creates a new thread with the priority priority. ">create(const sigc::slot&lt;void&gt;&amp;, unsigned long, bool, bool, ThreadPriority)</a> function, when you really can't use the simple <a class="el" href="classGlib_1_1Thread.html#a2775df2f24b6166e3fab41e69dcd04b6" title="Creates a new thread with the priority THREAD_PRIORITY_NORMAL. ">create(const sigc::slot&lt;void&gt;&amp;, bool)</a> instead. The latter overload does not take <em>stack_size</em>, <em>bound</em> and <em>priority</em> as arguments, as they should only be used for cases, where it is inevitable.</dd></dl>
<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">stack_size</td><td>A stack size for the new thread, or <code>0</code>. </td></tr>
    <tr><td class="paramname">joinable</td><td>Should this thread be joinable? </td></tr>
    <tr><td class="paramname">bound</td><td>Should this thread be bound to a system thread? </td></tr>
    <tr><td class="paramname">priority</td><td>A priority for the 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_1ThreadError.html" title="Exception class for thread-related errors. ">Glib::ThreadError</a></td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000029">Deprecated:</a></b></dt><dd>Use the simpler <a class="el" href="classGlib_1_1Thread.html#a2775df2f24b6166e3fab41e69dcd04b6" title="Creates a new thread with the priority THREAD_PRIORITY_NORMAL. ">create()</a> method instead, because all <a class="el" href="namespaceGlib_1_1Threads.html">Threads</a> are now joinable, and bounds and priority parameters now have no effect. </dd></dl>

</div>
</div>
<a class="anchor" id="a28d1bcf53d846b8b0d75b93178a614ab"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__glibmmEnums.html#ga9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a> Glib::Thread::get_priority </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the priority of the thread. </p>
<dl class="section return"><dt>Returns</dt><dd>The thread's priority.</dd></dl>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000032">Deprecated:</a></b></dt><dd><a class="el" href="classGlib_1_1Thread.html" title="Represents a running thread. ">Thread</a> priorities no longer have any effect. </dd></dl>

</div>
</div>
<a class="anchor" id="a28fbc6c46928a90d82114fa9b6b63196"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">GThread* Glib::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="a351fa5fb621a394e28037c4f50ab69ad"></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::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="ab95e51699279fd84c9577c45d76b0d8e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Glib::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_1Thread.html#a2775df2f24b6166e3fab41e69dcd04b6" title="Creates a new thread with the priority THREAD_PRIORITY_NORMAL. ">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_1Thread.html" title="Represents a running thread. ">Glib::Thread</a> object are released. The thread must have been created with <code>joinable&#160;=&#160;true</code>. </p>

</div>
</div>
<a class="anchor" id="a9feee4b860d9928f86b9d255e2f2b133"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Glib::Thread::joinable </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns whether the thread is joinable. </p>
<dl class="section return"><dt>Returns</dt><dd>Whether the thread is joinable.</dd></dl>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000030">Deprecated:</a></b></dt><dd>All threads are now joinable. </dd></dl>

</div>
</div>
<a class="anchor" id="a9db6864c35701b1c179f48217ab76cca"></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_1Thread.html">Thread</a>* Glib::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="a3b323f981147d7eb4b4bd03f3fbdccf5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Glib::Thread::set_priority </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__glibmmEnums.html#ga9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a>&#160;</td>
          <td class="paramname"><em>priority</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Changes the priority of the thread to <em>priority</em>. </p>
<dl class="section note"><dt>Note</dt><dd>It is not guaranteed, that threads with different priorities really behave accordingly. On some systems (e.g. Linux) only <code>root</code> can increase priorities. On other systems (e.g. Solaris) there doesn't seem to be different scheduling for different priorities. All in all try to avoid being dependent on priorities. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">priority</td><td>A new priority for the thread.</td></tr>
  </table>
  </dd>
</dl>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000031">Deprecated:</a></b></dt><dd><a class="el" href="classGlib_1_1Thread.html" title="Represents a running thread. ">Thread</a> priorities no longer have any effect. </dd></dl>

</div>
</div>
<a class="anchor" id="acad8be7a8093ef3aca32344264461011"></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::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>
<h2 class="groupheader">Friends And Related Function Documentation</h2>
<a class="anchor" id="a6bfbb3119eaac9fa8cb725aa1e82f61e"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classGlib_1_1Thread.html">Thread</a>* wrap </td>
          <td>(</td>
          <td class="paramtype">GThread *&#160;</td>
          <td class="paramname"><em>gobject</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000014">Deprecated:</a></b></dt><dd>Use Glib::Threads::wrap(GThread*) instead. </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon Sep 22 2014 21:38:33 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>