1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3
<title>glibmm 2.4: Glib::Thread Class Reference</title>
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3
<title>glibmm: Glib::Thread Class Reference</title>
4
<link href="tabs.css" rel="stylesheet" type="text/css">
4
5
<link href="doxygen.css" rel="stylesheet" type="text/css">
6
<body bgcolor="#ffffff">
7
<table border="0" width="100%">
9
<td width="10%" height="40"><img src="../../images/gtkmm_logo.gif" alt="logo" border="0" width="100%" height="100%"/></td>
10
<td width="90%" height="40"><img src="../../images/top.gif" alt="top" width="100%" height="40"/></td>
14
<a class="qindex" href="http://www.gtkmm.org/documentation.shtml">Main Page</a>
15
<a class="qindex" href="namespaces.html">glibmm Namespaces</a>
16
<a href="../../../../gtkmm-2.4/docs/tutorial/html/index.html"> Book</a>
20
<!-- begin main content -->
22
<!-- Generated by Doxygen 1.5.9 -->
7
<!-- Generated by Doxygen 1.5.8 -->
8
<div class="navigation" id="top">
11
<li><a href="index.html"><span>Main Page</span></a></li>
12
<li><a href="pages.html"><span>Related Pages</span></a></li>
13
<li><a href="modules.html"><span>Modules</span></a></li>
14
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
15
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
16
<li><a href="examples.html"><span>Examples</span></a></li>
21
<li><a href="annotated.html"><span>Class List</span></a></li>
22
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
23
<li><a href="functions.html"><span>Class Members</span></a></li>
23
26
<div class="navpath"><a class="el" href="namespaceGlib.html">Glib</a>::<a class="el" href="classGlib_1_1Thread.html">Thread</a>
25
29
<div class="contents">
26
30
<h1>Glib::Thread Class Reference<br>
28
32
[<a class="el" href="group__Threads.html">Threads</a>]</small>
29
</h1><!-- doxytag: class="Glib::Thread" -->Represents a running thread.
30
<a href="#_details">More...</a>
33
</h1><!-- doxytag: class="Glib::Thread" -->Represents a running thread. <a href="#_details">More...</a>
34
37
<a href="classGlib_1_1Thread-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
36
39
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
37
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread_1_1Exit.html">Exit</a></td></tr>
40
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread_1_1Exit.html">Exit</a></td></tr>
39
<tr><td class="mdescLeft"> </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>
42
<tr><td class="mdescLeft"> </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>
40
43
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
41
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#9feee4b860d9928f86b9d255e2f2b133">joinable</a> () const </td></tr>
43
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns whether the thread is joinable. <a href="#9feee4b860d9928f86b9d255e2f2b133"></a><br></td></tr>
44
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#b95e51699279fd84c9577c45d76b0d8e">join</a> ()</td></tr>
46
<tr><td class="mdescLeft"> </td><td class="mdescRight">Waits until the thread finishes. <a href="#b95e51699279fd84c9577c45d76b0d8e"></a><br></td></tr>
47
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#3b323f981147d7eb4b4bd03f3fbdccf5">set_priority</a> (<a class="el" href="group__glibmmEnums.html#g9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a> priority)</td></tr>
49
<tr><td class="mdescLeft"> </td><td class="mdescRight">Changes the priority of the thread to <em>priority</em>. <a href="#3b323f981147d7eb4b4bd03f3fbdccf5"></a><br></td></tr>
50
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__glibmmEnums.html#g9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#28d1bcf53d846b8b0d75b93178a614ab">get_priority</a> () const </td></tr>
52
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the priority of the thread. <a href="#28d1bcf53d846b8b0d75b93178a614ab"></a><br></td></tr>
53
<tr><td class="memItemLeft" nowrap align="right" valign="top">GThread* </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#28fbc6c46928a90d82114fa9b6b63196">gobj</a> ()</td></tr>
55
<tr><td class="memItemLeft" nowrap align="right" valign="top">const GThread* </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#351fa5fb621a394e28037c4f50ab69ad">gobj</a> () const </td></tr>
44
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#9feee4b860d9928f86b9d255e2f2b133">joinable</a> () const </td></tr>
46
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns whether the thread is joinable. <a href="#9feee4b860d9928f86b9d255e2f2b133"></a><br></td></tr>
47
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#b95e51699279fd84c9577c45d76b0d8e">join</a> ()</td></tr>
49
<tr><td class="mdescLeft"> </td><td class="mdescRight">Waits until the thread finishes. <a href="#b95e51699279fd84c9577c45d76b0d8e"></a><br></td></tr>
50
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#3b323f981147d7eb4b4bd03f3fbdccf5">set_priority</a> (<a class="el" href="group__glibmmEnums.html#g9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a> priority)</td></tr>
52
<tr><td class="mdescLeft"> </td><td class="mdescRight">Changes the priority of the thread to <em>priority</em>. <a href="#3b323f981147d7eb4b4bd03f3fbdccf5"></a><br></td></tr>
53
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__glibmmEnums.html#g9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#28d1bcf53d846b8b0d75b93178a614ab">get_priority</a> () const </td></tr>
55
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the priority of the thread. <a href="#28d1bcf53d846b8b0d75b93178a614ab"></a><br></td></tr>
56
<tr><td class="memItemLeft" nowrap align="right" valign="top">GThread* </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#28fbc6c46928a90d82114fa9b6b63196">gobj</a> ()</td></tr>
58
<tr><td class="memItemLeft" nowrap align="right" valign="top">const GThread* </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#351fa5fb621a394e28037c4f50ab69ad">gobj</a> () const </td></tr>
57
60
<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
58
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classGlib_1_1Thread.html">Thread</a>* </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#b165854ff2fc9b454ee4d97050485782">create</a> (const sigc::slot<void>& slot, bool joinable)</td></tr>
60
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a new thread with the priority <code>THREAD_PRIORITY_NORMAL</code>. <a href="#b165854ff2fc9b454ee4d97050485782"></a><br></td></tr>
61
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classGlib_1_1Thread.html">Thread</a>* </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#f30a7a8b037c7c7a3802aa2a22cf612d">create</a> (const sigc::slot<void>& slot, unsigned long stack_size, bool joinable, bool bound, <a class="el" href="group__glibmmEnums.html#g9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a> priority)</td></tr>
63
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a new thread with the priority <em>priority</em>. <a href="#f30a7a8b037c7c7a3802aa2a22cf612d"></a><br></td></tr>
64
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classGlib_1_1Thread.html">Thread</a>* </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#9db6864c35701b1c179f48217ab76cca">self</a> ()</td></tr>
66
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the Thread* corresponding to the calling thread. <a href="#9db6864c35701b1c179f48217ab76cca"></a><br></td></tr>
67
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#cad8be7a8093ef3aca32344264461011">yield</a> ()</td></tr>
69
<tr><td class="mdescLeft"> </td><td class="mdescRight">Gives way to other threads waiting to be scheduled. <a href="#cad8be7a8093ef3aca32344264461011"></a><br></td></tr>
61
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classGlib_1_1Thread.html">Thread</a>* </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#b165854ff2fc9b454ee4d97050485782">create</a> (const sigc::slot< void >&<a class="elRef" doxygen="libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/classsigc_1_1slot.html">slot</a>, bool joinable)</td></tr>
63
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a new thread with the priority <code>THREAD_PRIORITY_NORMAL</code>. <a href="#b165854ff2fc9b454ee4d97050485782"></a><br></td></tr>
64
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classGlib_1_1Thread.html">Thread</a>* </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#f30a7a8b037c7c7a3802aa2a22cf612d">create</a> (const sigc::slot< void >&<a class="elRef" doxygen="libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/classsigc_1_1slot.html">slot</a>, unsigned long stack_size, bool joinable, bool bound, <a class="el" href="group__glibmmEnums.html#g9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a> priority)</td></tr>
66
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a new thread with the priority <em>priority</em>. <a href="#f30a7a8b037c7c7a3802aa2a22cf612d"></a><br></td></tr>
67
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classGlib_1_1Thread.html">Thread</a>* </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#9db6864c35701b1c179f48217ab76cca">self</a> ()</td></tr>
69
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the Thread* corresponding to the calling thread. <a href="#9db6864c35701b1c179f48217ab76cca"></a><br></td></tr>
70
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#cad8be7a8093ef3aca32344264461011">yield</a> ()</td></tr>
72
<tr><td class="mdescLeft"> </td><td class="mdescRight">Gives way to other threads waiting to be scheduled. <a href="#cad8be7a8093ef3aca32344264461011"></a><br></td></tr>
70
73
<tr><td colspan="2"><br><h2>Related Functions</h2></td></tr>
71
74
<tr><td colspan="2">(Note that these are not member functions.) <br><br></td></tr>
72
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classGlib_1_1Thread.html">Thread</a>* </td><td class="memItemRight" valign="bottom"><a class="el" href="group__Threads.html#g6bfbb3119eaac9fa8cb725aa1e82f61e">wrap</a> (GThread* gobject)</td></tr>
75
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classGlib_1_1Thread.html">Thread</a>* </td><td class="memItemRight" valign="bottom"><a class="el" href="group__Threads.html#g6bfbb3119eaac9fa8cb725aa1e82f61e">wrap</a> (GThread* gobject)</td></tr>
75
78
<hr><a name="_details"></a><h2>Detailed Description</h2>
76
Represents a running thread.
79
Represents a running thread. <p>
78
80
An instance of this class can only be obtained with <a class="el" href="classGlib_1_1Thread.html#b165854ff2fc9b454ee4d97050485782" title="Creates a new thread with the priority THREAD_PRIORITY_NORMAL.">create()</a>, <a class="el" href="classGlib_1_1Thread.html#9db6864c35701b1c179f48217ab76cca" title="Returns the Thread* corresponding to the calling thread.">self()</a>, or <a class="el" href="group__Threads.html#g6bfbb3119eaac9fa8cb725aa1e82f61e">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#b95e51699279fd84c9577c45d76b0d8e" title="Waits until the thread finishes.">join()</a> to avoid a memory leak.<p>
79
81
<dl class="note" compact><dt><b>Note:</b></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.<p>
80
82
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>
81
83
<dl compact><dt><b>Examples: </b></dt><dd>
84
<a class="el" href="thread_2dispatcher_8cc-example.html#_a0">thread/dispatcher.cc</a>, and <a class="el" href="thread_2thread_8cc-example.html#_a11">thread/thread.cc</a>.</dl><hr><h2>Member Function Documentation</h2>
86
<a class="el" href="thread_2dispatcher_8cc-example.html#_a1">thread/dispatcher.cc</a>, and <a class="el" href="thread_2thread_8cc-example.html#_a12">thread/thread.cc</a>.</dl><hr><h2>Member Function Documentation</h2>
85
87
<a class="anchor" name="f30a7a8b037c7c7a3802aa2a22cf612d"></a><!-- doxytag: member="Glib::Thread::create" ref="f30a7a8b037c7c7a3802aa2a22cf612d" args="(const sigc::slot< void > &slot, unsigned long stack_size, bool joinable, bool bound, ThreadPriority priority)" -->
86
88
<div class="memitem">
87
89
<div class="memproto">
88
90
<table class="memname">
90
<td class="memname">static <a class="el" href="classGlib_1_1Thread.html">Thread</a>* Glib::Thread::create </td>
92
<td class="memname">static <a class="el" href="classGlib_1_1Thread.html">Thread</a>* Glib::Thread::create </td>
92
<td class="paramtype">const sigc::slot< void > & </td>
94
<td class="paramtype">const sigc::slot< void > & </td>
93
95
<td class="paramname"> <em>slot</em>, </td>
96
98
<td class="paramkey"></td>
98
<td class="paramtype">unsigned long </td>
100
<td class="paramtype">unsigned long </td>
99
101
<td class="paramname"> <em>stack_size</em>, </td>
102
104
<td class="paramkey"></td>
104
<td class="paramtype">bool </td>
106
<td class="paramtype">bool </td>
105
107
<td class="paramname"> <em>joinable</em>, </td>
108
110
<td class="paramkey"></td>
110
<td class="paramtype">bool </td>
112
<td class="paramtype">bool </td>
111
113
<td class="paramname"> <em>bound</em>, </td>
114
116
<td class="paramkey"></td>
116
<td class="paramtype"><a class="el" href="group__glibmmEnums.html#g9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a> </td>
117
<td class="paramname"> <em>priority</em></td><td> </td>
118
<td class="paramtype"><a class="el" href="group__glibmmEnums.html#g9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a> </td>
119
<td class="paramname"> <em>priority</em></td><td> </td>
126
128
<div class="memdoc">
129
Creates a new thread with the priority <em>priority</em>.
131
Creates a new thread with the priority <em>priority</em>. <p>
131
132
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>
132
133
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#b95e51699279fd84c9577c45d76b0d8e" 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>
133
The new thread executes the function or method <em>slot</em> points to. You can pass additional arguments using sigc::bind(). If the thread was created successfully, it is returned.<p>
134
Because <a class="el" href="classsigc_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="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/group__s20__3__8__memadaptors.html#ga2">sigc::mem_fun()</a>), the class concerned should not derive from <a class="el" href="classsigc_1_1trackable.html">sigc::trackable</a>.<p>
134
The new thread executes the function or method <em>slot</em> points to. You can pass additional arguments using <a class="elRef" doxygen="libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/group__bind.html#g2148290d2cf9c1961ec157a085badd5a">sigc::bind()</a>. If the thread was created successfully, it is returned.<p>
135
Because <a class="elRef" doxygen="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="libstdc++.tag:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01024.html#g46b3aee55bddccc454ea4f8edc26ffa7">sigc::mem_fun()</a>), the class concerned should not derive from <a class="elRef" doxygen="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>
135
136
<dl class="note" compact><dt><b>Note:</b></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="group__glibmmEnums.html#gg9b87dca6496b6ad53baec9ca013184486216bb25baaaca32642841ade911a92e">Glib::THREAD_PRIORITY_NORMAL</a></code> here as a default.<p>
136
137
Only use the extended <a class="el" href="classGlib_1_1Thread.html#f30a7a8b037c7c7a3802aa2a22cf612d" title="Creates a new thread with the priority priority.">create(const sigc::slot<void>&, unsigned long, bool, bool, ThreadPriority)</a> function, when you really can't use the simple <a class="el" href="classGlib_1_1Thread.html#b165854ff2fc9b454ee4d97050485782" title="Creates a new thread with the priority THREAD_PRIORITY_NORMAL.">create(const sigc::slot<void>&, 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>
137
138
<dl compact><dt><b>Parameters:</b></dt><dd>
138
139
<table border="0" cellspacing="2" cellpadding="0">
139
<tr><td valign="top"></td><td valign="top"><em>slot</em> </td><td>A slot to execute in the new thread. </td></tr>
140
<tr><td valign="top"></td><td valign="top"><em>stack_size</em> </td><td>A stack size for the new thread, or <code>0</code>. </td></tr>
141
<tr><td valign="top"></td><td valign="top"><em>joinable</em> </td><td>Should this thread be joinable? </td></tr>
142
<tr><td valign="top"></td><td valign="top"><em>bound</em> </td><td>Should this thread be bound to a system thread? </td></tr>
143
<tr><td valign="top"></td><td valign="top"><em>priority</em> </td><td>A priority for the thread. </td></tr>
140
<tr><td valign="top"></td><td valign="top"><em>slot</em> </td><td>A slot to execute in the new thread. </td></tr>
141
<tr><td valign="top"></td><td valign="top"><em>stack_size</em> </td><td>A stack size for the new thread, or <code>0</code>. </td></tr>
142
<tr><td valign="top"></td><td valign="top"><em>joinable</em> </td><td>Should this thread be joinable? </td></tr>
143
<tr><td valign="top"></td><td valign="top"><em>bound</em> </td><td>Should this thread be bound to a system thread? </td></tr>
144
<tr><td valign="top"></td><td valign="top"><em>priority</em> </td><td>A priority for the thread. </td></tr>
146
147
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The new Thread* on success. </dd></dl>
147
148
<dl compact><dt><b>Exceptions:</b></dt><dd>
148
149
<table border="0" cellspacing="2" cellpadding="0">
149
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classGlib_1_1ThreadError.html" title="Exception class for thread-related errors.">Glib::ThreadError</a></em> </td><td></td></tr>
150
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classGlib_1_1ThreadError.html" title="Exception class for thread-related errors.">Glib::ThreadError</a></em> </td><td></td></tr>
178
179
<div class="memdoc">
181
Creates a new thread with the priority <code>THREAD_PRIORITY_NORMAL</code>.
182
Creates a new thread with the priority <code>THREAD_PRIORITY_NORMAL</code>. <p>
183
183
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#b95e51699279fd84c9577c45d76b0d8e" title="Waits until the thread finishes.">join()</a>. Otherwise the thread will just disappear, when ready.<p>
184
The new thread executes the function or method <em>slot</em> points to. You can pass additional arguments using sigc::bind(). 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>
185
Because <a class="el" href="classsigc_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="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/group__s20__3__8__memadaptors.html#ga2">sigc::mem_fun()</a>), the class concerned should not derive from <a class="el" href="classsigc_1_1trackable.html">sigc::trackable</a>.<p>
184
The new thread executes the function or method <em>slot</em> points to. You can pass additional arguments using <a class="elRef" doxygen="libsigc++-2.0.tag:http://library.gnome.org/devel/libsigc++/unstable/" href="http://library.gnome.org/devel/libsigc++/unstable/group__bind.html#g2148290d2cf9c1961ec157a085badd5a">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>
185
Because <a class="elRef" doxygen="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="libstdc++.tag:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01024.html#g46b3aee55bddccc454ea4f8edc26ffa7">sigc::mem_fun()</a>), the class concerned should not derive from <a class="elRef" doxygen="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>
186
186
<dl compact><dt><b>Parameters:</b></dt><dd>
187
187
<table border="0" cellspacing="2" cellpadding="0">
188
<tr><td valign="top"></td><td valign="top"><em>slot</em> </td><td>A slot to execute in the new thread. </td></tr>
189
<tr><td valign="top"></td><td valign="top"><em>joinable</em> </td><td>Should this thread be joinable? </td></tr>
188
<tr><td valign="top"></td><td valign="top"><em>slot</em> </td><td>A slot to execute in the new thread. </td></tr>
189
<tr><td valign="top"></td><td valign="top"><em>joinable</em> </td><td>Should this thread be joinable? </td></tr>
192
192
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The new Thread* on success. </dd></dl>
193
193
<dl compact><dt><b>Exceptions:</b></dt><dd>
194
194
<table border="0" cellspacing="2" cellpadding="0">
195
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classGlib_1_1ThreadError.html" title="Exception class for thread-related errors.">Glib::ThreadError</a></em> </td><td></td></tr>
195
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classGlib_1_1ThreadError.html" title="Exception class for thread-related errors.">Glib::ThreadError</a></em> </td><td></td></tr>
198
198
<dl compact><dt><b>Examples: </b></dt><dd>
199
<a class="el" href="thread_2dispatcher_8cc-example.html#a6">thread/dispatcher.cc</a>, and <a class="el" href="thread_2thread_8cc-example.html#a12">thread/thread.cc</a>.</dl>
199
<a class="el" href="thread_2dispatcher_8cc-example.html#a7">thread/dispatcher.cc</a>, and <a class="el" href="thread_2thread_8cc-example.html#a13">thread/thread.cc</a>.</dl>
202
202
<a class="anchor" name="28d1bcf53d846b8b0d75b93178a614ab"></a><!-- doxytag: member="Glib::Thread::get_priority" ref="28d1bcf53d846b8b0d75b93178a614ab" args="() const " -->