~kklimonda/ubuntu/natty/glibmm2.4/update

« back to all changes in this revision

Viewing changes to docs/reference/html/classGlib_1_1Thread.html

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2009-08-28 08:32:22 UTC
  • mfrom: (1.2.38 upstream)
  • Revision ID: james.westby@ubuntu.com-20090828083222-qr6jekfjlsz52rb7
Tags: 2.21.4.1-0ubuntu1
* New upstream release: (LP: #419705)
  2.21.4.1
  - Reenable hierarchy graphs for each class
  - Remove header and footer HTML fragments
  - Use shared mm-common Doxygen style sheet
  2.21.4
  - Transition to new mm-common build infrastructure
  - Correct the if condition in Gio::MemoryInputStream::add_data().
* debian/control.in:
  - Remove debian VCS links as they confuse debcheckout
* debian/libglibmm-2.4-dev.install:
  - Install files from /usr/share/glibmm-2.4/doctool

Show diffs side-by-side

added added

removed removed

Lines of Context:
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">
5
 
</head>
6
 
<body bgcolor="#ffffff">
7
 
<table border="0" width="100%">
8
 
<tr>
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>
11
 
</tr>
12
 
</table>
13
 
<center>
14
 
  <a class="qindex" href="http://www.gtkmm.org/documentation.shtml">Main Page</a> &nbsp;
15
 
  <a class="qindex" href="namespaces.html">glibmm Namespaces</a> &nbsp;
16
 
  <a href="../../../../gtkmm-2.4/docs/tutorial/html/index.html"> Book</a> &nbsp;
17
 
</center>
18
 
<hr width="100%"/>
19
 
 
20
 
<!-- begin main content -->
21
 
<div id="content">
22
 
<!-- Generated by Doxygen 1.5.9 -->
 
6
</head><body>
 
7
<!-- Generated by Doxygen 1.5.8 -->
 
8
<div class="navigation" id="top">
 
9
  <div class="tabs">
 
10
    <ul>
 
11
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
 
12
      <li><a href="pages.html"><span>Related&#160;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>
 
17
    </ul>
 
18
  </div>
 
19
  <div class="tabs">
 
20
    <ul>
 
21
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
 
22
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
 
23
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
 
24
    </ul>
 
25
  </div>
23
26
  <div class="navpath"><a class="el" href="namespaceGlib.html">Glib</a>::<a class="el" href="classGlib_1_1Thread.html">Thread</a>
24
27
  </div>
 
28
</div>
25
29
<div class="contents">
26
30
<h1>Glib::Thread Class Reference<br>
27
31
<small>
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>
31
34
<p>
32
35
 
33
36
<p>
34
37
<a href="classGlib_1_1Thread-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
35
38
<tr><td></td></tr>
36
39
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
37
 
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</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&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread_1_1Exit.html">Exit</a></td></tr>
38
41
 
39
 
<tr><td class="mdescLeft">&nbsp;</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">&#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>
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&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#9feee4b860d9928f86b9d255e2f2b133">joinable</a> () const </td></tr>
42
 
 
43
 
<tr><td class="mdescLeft">&nbsp;</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&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#b95e51699279fd84c9577c45d76b0d8e">join</a> ()</td></tr>
45
 
 
46
 
<tr><td class="mdescLeft">&nbsp;</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&nbsp;</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>
48
 
 
49
 
<tr><td class="mdescLeft">&nbsp;</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>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#28d1bcf53d846b8b0d75b93178a614ab">get_priority</a> () const </td></tr>
51
 
 
52
 
<tr><td class="mdescLeft">&nbsp;</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*&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#28fbc6c46928a90d82114fa9b6b63196">gobj</a> ()</td></tr>
54
 
 
55
 
<tr><td class="memItemLeft" nowrap align="right" valign="top">const GThread*&nbsp;</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&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#9feee4b860d9928f86b9d255e2f2b133">joinable</a> () const </td></tr>
 
45
 
 
46
<tr><td class="mdescLeft">&#160;</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&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#b95e51699279fd84c9577c45d76b0d8e">join</a> ()</td></tr>
 
48
 
 
49
<tr><td class="mdescLeft">&#160;</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&#160;</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>
 
51
 
 
52
<tr><td class="mdescLeft">&#160;</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>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#28d1bcf53d846b8b0d75b93178a614ab">get_priority</a> () const </td></tr>
 
54
 
 
55
<tr><td class="mdescLeft">&#160;</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*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#28fbc6c46928a90d82114fa9b6b63196">gobj</a> ()</td></tr>
 
57
 
 
58
<tr><td class="memItemLeft" nowrap align="right" valign="top">const GThread*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#351fa5fb621a394e28037c4f50ab69ad">gobj</a> () const </td></tr>
56
59
 
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>*&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#b165854ff2fc9b454ee4d97050485782">create</a> (const sigc::slot&lt;void&gt;&amp; slot, bool joinable)</td></tr>
59
 
 
60
 
<tr><td class="mdescLeft">&nbsp;</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>*&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#f30a7a8b037c7c7a3802aa2a22cf612d">create</a> (const sigc::slot&lt;void&gt;&amp; slot, unsigned long stack_size, bool joinable, bool bound, <a class="el" href="group__glibmmEnums.html#g9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a> priority)</td></tr>
62
 
 
63
 
<tr><td class="mdescLeft">&nbsp;</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>*&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#9db6864c35701b1c179f48217ab76cca">self</a> ()</td></tr>
65
 
 
66
 
<tr><td class="mdescLeft">&nbsp;</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&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#cad8be7a8093ef3aca32344264461011">yield</a> ()</td></tr>
68
 
 
69
 
<tr><td class="mdescLeft">&nbsp;</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>*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#b165854ff2fc9b454ee4d97050485782">create</a> (const sigc::slot&lt; void &gt;&amp;<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>
 
62
 
 
63
<tr><td class="mdescLeft">&#160;</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>*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#f30a7a8b037c7c7a3802aa2a22cf612d">create</a> (const sigc::slot&lt; void &gt;&amp;<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>
 
65
 
 
66
<tr><td class="mdescLeft">&#160;</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>*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#9db6864c35701b1c179f48217ab76cca">self</a> ()</td></tr>
 
68
 
 
69
<tr><td class="mdescLeft">&#160;</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&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html#cad8be7a8093ef3aca32344264461011">yield</a> ()</td></tr>
 
71
 
 
72
<tr><td class="mdescLeft">&#160;</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>*&nbsp;</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>*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__Threads.html#g6bfbb3119eaac9fa8cb725aa1e82f61e">wrap</a> (GThread* gobject)</td></tr>
73
76
 
74
77
</table>
75
78
<hr><a name="_details"></a><h2>Detailed Description</h2>
76
 
Represents a running thread. 
77
 
<p>
 
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>
82
84
 
83
85
<p>
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&lt; void &gt; &amp;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">
89
91
        <tr>
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>
91
93
          <td>(</td>
92
 
          <td class="paramtype">const sigc::slot&lt; void &gt; &amp;&nbsp;</td>
 
94
          <td class="paramtype">const sigc::slot&lt; void &gt; &amp;&#160;</td>
93
95
          <td class="paramname"> <em>slot</em>, </td>
94
96
        </tr>
95
97
        <tr>
96
98
          <td class="paramkey"></td>
97
99
          <td></td>
98
 
          <td class="paramtype">unsigned long&nbsp;</td>
 
100
          <td class="paramtype">unsigned long&#160;</td>
99
101
          <td class="paramname"> <em>stack_size</em>, </td>
100
102
        </tr>
101
103
        <tr>
102
104
          <td class="paramkey"></td>
103
105
          <td></td>
104
 
          <td class="paramtype">bool&nbsp;</td>
 
106
          <td class="paramtype">bool&#160;</td>
105
107
          <td class="paramname"> <em>joinable</em>, </td>
106
108
        </tr>
107
109
        <tr>
108
110
          <td class="paramkey"></td>
109
111
          <td></td>
110
 
          <td class="paramtype">bool&nbsp;</td>
 
112
          <td class="paramtype">bool&#160;</td>
111
113
          <td class="paramname"> <em>bound</em>, </td>
112
114
        </tr>
113
115
        <tr>
114
116
          <td class="paramkey"></td>
115
117
          <td></td>
116
 
          <td class="paramtype"><a class="el" href="group__glibmmEnums.html#g9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a>&nbsp;</td>
117
 
          <td class="paramname"> <em>priority</em></td><td>&nbsp;</td>
 
118
          <td class="paramtype"><a class="el" href="group__glibmmEnums.html#g9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a>&#160;</td>
 
119
          <td class="paramname"> <em>priority</em></td><td>&#160;</td>
118
120
        </tr>
119
121
        <tr>
120
122
          <td></td>
126
128
<div class="memdoc">
127
129
 
128
130
<p>
129
 
Creates a new thread with the priority <em>priority</em>. 
130
 
<p>
 
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&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#b165854ff2fc9b454ee4d97050485782" 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>
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>&nbsp;</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>&nbsp;</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>&nbsp;</td><td>Should this thread be joinable? </td></tr>
142
 
    <tr><td valign="top"></td><td valign="top"><em>bound</em>&nbsp;</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>&nbsp;</td><td>A priority for the thread. </td></tr>
 
140
    <tr><td valign="top"></td><td valign="top"><em>slot</em>&#160;</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>&#160;</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>&#160;</td><td>Should this thread be joinable? </td></tr>
 
143
    <tr><td valign="top"></td><td valign="top"><em>bound</em>&#160;</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>&#160;</td><td>A priority for the thread. </td></tr>
144
145
  </table>
145
146
</dl>
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>&nbsp;</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>&#160;</td><td></td></tr>
150
151
  </table>
151
152
</dl>
152
153
 
157
158
<div class="memproto">
158
159
      <table class="memname">
159
160
        <tr>
160
 
          <td class="memname">static <a class="el" href="classGlib_1_1Thread.html">Thread</a>* Glib::Thread::create           </td>
 
161
          <td class="memname">static <a class="el" href="classGlib_1_1Thread.html">Thread</a>* Glib::Thread::create </td>
161
162
          <td>(</td>
162
 
          <td class="paramtype">const sigc::slot&lt; void &gt; &amp;&nbsp;</td>
 
163
          <td class="paramtype">const sigc::slot&lt; void &gt; &amp;&#160;</td>
163
164
          <td class="paramname"> <em>slot</em>, </td>
164
165
        </tr>
165
166
        <tr>
166
167
          <td class="paramkey"></td>
167
168
          <td></td>
168
 
          <td class="paramtype">bool&nbsp;</td>
169
 
          <td class="paramname"> <em>joinable</em></td><td>&nbsp;</td>
 
169
          <td class="paramtype">bool&#160;</td>
 
170
          <td class="paramname"> <em>joinable</em></td><td>&#160;</td>
170
171
        </tr>
171
172
        <tr>
172
173
          <td></td>
178
179
<div class="memdoc">
179
180
 
180
181
<p>
181
 
Creates a new thread with the priority <code>THREAD_PRIORITY_NORMAL</code>. 
182
 
<p>
 
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>&nbsp;</td><td>A slot to execute in the new thread. </td></tr>
189
 
    <tr><td valign="top"></td><td valign="top"><em>joinable</em>&nbsp;</td><td>Should this thread be joinable? </td></tr>
 
188
    <tr><td valign="top"></td><td valign="top"><em>slot</em>&#160;</td><td>A slot to execute in the new thread. </td></tr>
 
189
    <tr><td valign="top"></td><td valign="top"><em>joinable</em>&#160;</td><td>Should this thread be joinable? </td></tr>
190
190
  </table>
191
191
</dl>
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>&nbsp;</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>&#160;</td><td></td></tr>
196
196
  </table>
197
197
</dl>
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>
200
200
</div>
201
201
</div><p>
202
202
<a class="anchor" name="28d1bcf53d846b8b0d75b93178a614ab"></a><!-- doxytag: member="Glib::Thread::get_priority" ref="28d1bcf53d846b8b0d75b93178a614ab" args="() const " -->
204
204
<div class="memproto">
205
205
      <table class="memname">
206
206
        <tr>
207
 
          <td class="memname"><a class="el" href="group__glibmmEnums.html#g9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a> Glib::Thread::get_priority           </td>
 
207
          <td class="memname"><a class="el" href="group__glibmmEnums.html#g9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a> Glib::Thread::get_priority </td>
208
208
          <td>(</td>
209
 
          <td class="paramname">          </td>
210
 
          <td>&nbsp;)&nbsp;</td>
 
209
          <td class="paramname"> </td>
 
210
          <td>&#160;)&#160;</td>
211
211
          <td> const</td>
212
212
        </tr>
213
213
      </table>
215
215
<div class="memdoc">
216
216
 
217
217
<p>
218
 
Returns the priority of the thread. 
219
 
<p>
 
218
Returns the priority of the thread. <p>
220
219
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The thread's priority. </dd></dl>
221
220
 
222
221
</div>
226
225
<div class="memproto">
227
226
      <table class="memname">
228
227
        <tr>
229
 
          <td class="memname">const GThread* Glib::Thread::gobj           </td>
 
228
          <td class="memname">const GThread* Glib::Thread::gobj </td>
230
229
          <td>(</td>
231
 
          <td class="paramname">          </td>
232
 
          <td>&nbsp;)&nbsp;</td>
 
230
          <td class="paramname"> </td>
 
231
          <td>&#160;)&#160;</td>
233
232
          <td> const<code> [inline]</code></td>
234
233
        </tr>
235
234
      </table>
245
244
<div class="memproto">
246
245
      <table class="memname">
247
246
        <tr>
248
 
          <td class="memname">GThread* Glib::Thread::gobj           </td>
 
247
          <td class="memname">GThread* Glib::Thread::gobj </td>
249
248
          <td>(</td>
250
 
          <td class="paramname">          </td>
251
 
          <td>&nbsp;)&nbsp;</td>
 
249
          <td class="paramname"> </td>
 
250
          <td>&#160;)&#160;</td>
252
251
          <td><code> [inline]</code></td>
253
252
        </tr>
254
253
      </table>
264
263
<div class="memproto">
265
264
      <table class="memname">
266
265
        <tr>
267
 
          <td class="memname">void Glib::Thread::join           </td>
 
266
          <td class="memname">void Glib::Thread::join </td>
268
267
          <td>(</td>
269
 
          <td class="paramname">          </td>
270
 
          <td>&nbsp;)&nbsp;</td>
 
268
          <td class="paramname"> </td>
 
269
          <td>&#160;)&#160;</td>
271
270
          <td></td>
272
271
        </tr>
273
272
      </table>
275
274
<div class="memdoc">
276
275
 
277
276
<p>
278
 
Waits until the thread finishes. 
279
 
<p>
280
 
Waits until the thread finishes, i.e. the slot, as given to <a class="el" href="classGlib_1_1Thread.html#b165854ff2fc9b454ee4d97050485782" 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&nbsp;=&nbsp;true</code>. <dl compact><dt><b>Examples: </b></dt><dd>
281
 
<a class="el" href="thread_2thread_8cc-example.html#a14">thread/thread.cc</a>.</dl>
 
277
Waits until the thread finishes. <p>
 
278
Waits until the thread finishes, i.e. the slot, as given to <a class="el" href="classGlib_1_1Thread.html#b165854ff2fc9b454ee4d97050485782" 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>. <dl compact><dt><b>Examples: </b></dt><dd>
 
279
<a class="el" href="thread_2thread_8cc-example.html#a15">thread/thread.cc</a>.</dl>
282
280
</div>
283
281
</div><p>
284
282
<a class="anchor" name="9feee4b860d9928f86b9d255e2f2b133"></a><!-- doxytag: member="Glib::Thread::joinable" ref="9feee4b860d9928f86b9d255e2f2b133" args="() const " -->
286
284
<div class="memproto">
287
285
      <table class="memname">
288
286
        <tr>
289
 
          <td class="memname">bool Glib::Thread::joinable           </td>
 
287
          <td class="memname">bool Glib::Thread::joinable </td>
290
288
          <td>(</td>
291
 
          <td class="paramname">          </td>
292
 
          <td>&nbsp;)&nbsp;</td>
 
289
          <td class="paramname"> </td>
 
290
          <td>&#160;)&#160;</td>
293
291
          <td> const</td>
294
292
        </tr>
295
293
      </table>
297
295
<div class="memdoc">
298
296
 
299
297
<p>
300
 
Returns whether the thread is joinable. 
301
 
<p>
 
298
Returns whether the thread is joinable. <p>
302
299
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Whether the thread is joinable. </dd></dl>
303
300
 
304
301
</div>
308
305
<div class="memproto">
309
306
      <table class="memname">
310
307
        <tr>
311
 
          <td class="memname">static <a class="el" href="classGlib_1_1Thread.html">Thread</a>* Glib::Thread::self           </td>
 
308
          <td class="memname">static <a class="el" href="classGlib_1_1Thread.html">Thread</a>* Glib::Thread::self </td>
312
309
          <td>(</td>
313
 
          <td class="paramname">          </td>
314
 
          <td>&nbsp;)&nbsp;</td>
 
310
          <td class="paramname"> </td>
 
311
          <td>&#160;)&#160;</td>
315
312
          <td><code> [static]</code></td>
316
313
        </tr>
317
314
      </table>
319
316
<div class="memdoc">
320
317
 
321
318
<p>
322
 
Returns the Thread* corresponding to the calling thread. 
323
 
<p>
 
319
Returns the Thread* corresponding to the calling thread. <p>
324
320
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The current thread. </dd></dl>
325
321
 
326
322
</div>
330
326
<div class="memproto">
331
327
      <table class="memname">
332
328
        <tr>
333
 
          <td class="memname">void Glib::Thread::set_priority           </td>
 
329
          <td class="memname">void Glib::Thread::set_priority </td>
334
330
          <td>(</td>
335
 
          <td class="paramtype"><a class="el" href="group__glibmmEnums.html#g9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a>&nbsp;</td>
336
 
          <td class="paramname"> <em>priority</em>          </td>
337
 
          <td>&nbsp;)&nbsp;</td>
 
331
          <td class="paramtype"><a class="el" href="group__glibmmEnums.html#g9b87dca6496b6ad53baec9ca01318448">ThreadPriority</a>&#160;</td>
 
332
          <td class="paramname"> <em>priority</em> </td>
 
333
          <td>&#160;)&#160;</td>
338
334
          <td></td>
339
335
        </tr>
340
336
      </table>
342
338
<div class="memdoc">
343
339
 
344
340
<p>
345
 
Changes the priority of the thread to <em>priority</em>. 
346
 
<p>
 
341
Changes the priority of the thread to <em>priority</em>. <p>
347
342
<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 <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>
348
343
<dl compact><dt><b>Parameters:</b></dt><dd>
349
344
  <table border="0" cellspacing="2" cellpadding="0">
350
 
    <tr><td valign="top"></td><td valign="top"><em>priority</em>&nbsp;</td><td>A new priority for the thread. </td></tr>
 
345
    <tr><td valign="top"></td><td valign="top"><em>priority</em>&#160;</td><td>A new priority for the thread. </td></tr>
351
346
  </table>
352
347
</dl>
353
348
 
358
353
<div class="memproto">
359
354
      <table class="memname">
360
355
        <tr>
361
 
          <td class="memname">static void Glib::Thread::yield           </td>
 
356
          <td class="memname">static void Glib::Thread::yield </td>
362
357
          <td>(</td>
363
 
          <td class="paramname">          </td>
364
 
          <td>&nbsp;)&nbsp;</td>
 
358
          <td class="paramname"> </td>
 
359
          <td>&#160;)&#160;</td>
365
360
          <td><code> [static]</code></td>
366
361
        </tr>
367
362
      </table>
369
364
<div class="memdoc">
370
365
 
371
366
<p>
372
 
Gives way to other threads waiting to be scheduled. 
373
 
<p>
374
 
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. 
375
 
</div>
 
367
Gives way to other threads waiting to be scheduled. <p>
 
368
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. </div>
376
369
</div><p>
377
370
<hr>The documentation for this class was generated from the following file:<ul>
378
 
<li><a class="el" href="thread_8h.html">thread.h</a></ul>
 
371
<li>glibmm/thread.h</ul>
379
372
</div>
380
 
</div> <!-- end main content -->
381
 
 
382
 
<hr><address><small>
383
 
Generated for glibmm 2.4 by <a href="http://www.doxygen.org/index.html">
384
 
Doxygen</a> 1.5.9 &copy;&nbsp;1997-2001</small></address>
 
373
<hr size="1"><address style="text-align: right;"><small>Generated on Fri Aug 28 16:45:01 2009 for glibmm by&#160;
 
374
<a href="http://www.doxygen.org/index.html">
 
375
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
385
376
</body>
386
377
</html>