File: Poco.Thread.html

package info (click to toggle)
poco-doc 1.3.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,096 kB
  • sloc: makefile: 9
file content (230 lines) | stat: -rw-r--r-- 15,516 bytes parent folder | download | duplicates (3)
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
<!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>
<title>Class Poco::Thread</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.html" class="namespace">Poco</a></h1>
<h1 class="symbol">class Thread</h1>
</div>
<div class="body">
<p>
<b>Library:</b> Foundation<br />
<b>Package:</b> Threading<br />
<b>Header:</b> Poco/Thread.h</p>
<h2>Description</h2>
<div class="description">
<p>This class implements a platform-independent wrapper to an operating system thread. </p>
<p>Every <a href="Poco.Thread.html" title="class Poco::Thread">Thread</a> object gets a unique (within its process) numeric thread ID. Furthermore, a thread can be assigned a name. The name of a thread can be changed at any time. </p>
</div>
<h2>Inheritance</h2>
<p><b>Direct Base Classes: </b>ThreadImpl</p>
<p><b>All Base Classes: </b>ThreadImpl</p>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.Thread.html#10859" title="Poco::Thread::clearTLS()">clearTLS</a>, <a href="Poco.Thread.html#10856" title="Poco::Thread::current()">current</a>, <a href="Poco.Thread.html#10857" title="Poco::Thread::currentTid()">currentTid</a>, <a href="Poco.Thread.html#10838" title="Poco::Thread::getMaxOSPriority()">getMaxOSPriority</a>, <a href="Poco.Thread.html#10837" title="Poco::Thread::getMinOSPriority()">getMinOSPriority</a>, <a href="Poco.Thread.html#10828" title="Poco::Thread::getName()">getName</a>, <a href="Poco.Thread.html#10836" title="Poco::Thread::getOSPriority()">getOSPriority</a>, <a href="Poco.Thread.html#10833" title="Poco::Thread::getPriority()">getPriority</a>, <a href="Poco.Thread.html#10841" title="Poco::Thread::getStackSize()">getStackSize</a>, <a href="Poco.Thread.html#10825" title="Poco::Thread::id()">id</a>, <a href="Poco.Thread.html#10852" title="Poco::Thread::isRunning()">isRunning</a>, <a href="Poco.Thread.html#10847" title="Poco::Thread::join()">join</a>, <a href="Poco.Thread.html#10860" title="Poco::Thread::makeName()">makeName</a>, <a href="Poco.Thread.html#10827" title="Poco::Thread::name()">name</a>, <a href="Poco.Thread.html#10829" title="Poco::Thread::setName()">setName</a>, <a href="Poco.Thread.html#10834" title="Poco::Thread::setOSPriority()">setOSPriority</a>, <a href="Poco.Thread.html#10831" title="Poco::Thread::setPriority()">setPriority</a>, <a href="Poco.Thread.html#10839" title="Poco::Thread::setStackSize()">setStackSize</a>, <a href="Poco.Thread.html#10853" title="Poco::Thread::sleep()">sleep</a>, <a href="Poco.Thread.html#10842" title="Poco::Thread::start()">start</a>, <a href="Poco.Thread.html#10826" title="Poco::Thread::tid()">tid</a>, <a href="Poco.Thread.html#10858" title="Poco::Thread::tls()">tls</a>, <a href="Poco.Thread.html#10850" title="Poco::Thread::tryJoin()">tryJoin</a>, <a href="Poco.Thread.html#10861" title="Poco::Thread::uniqueId()">uniqueId</a>, <a href="Poco.Thread.html#10855" title="Poco::Thread::yield()">yield</a></p>
<h2>Types</h2>
<h3><a name="10813">TID</a></h3>
<p class="decl">typedef ThreadImpl::TIDImpl <a href="Poco.Thread.html#10813" title="Poco::Thread::TID">TID</a>;</p>
<div class="description">
<p></p>
</div>
<h2>Enumerations</h2>
<h3><a name="10815">Priority</a></h3>
<div class="description">
<p><a href="Poco.Thread.html" title="class Poco::Thread">Thread</a> priorities. </p>
</div>
<p class="decl"><a name="10816">PRIO_LOWEST</a> = PRIO_LOWEST_IMPL</p>
<div class="description">
<p>The lowest thread priority. </p>
</div>
<p class="decl"><a name="10817">PRIO_LOW</a> = PRIO_LOW_IMPL</p>
<div class="description">
<p>A lower than normal thread priority. </p>
</div>
<p class="decl"><a name="10818">PRIO_NORMAL</a> = PRIO_NORMAL_IMPL</p>
<div class="description">
<p>The normal thread priority. </p>
</div>
<p class="decl"><a name="10819">PRIO_HIGH</a> = PRIO_HIGH_IMPL</p>
<div class="description">
<p>A higher than normal thread priority. </p>
</div>
<p class="decl"><a name="10820">PRIO_HIGHEST</a> = PRIO_HIGHEST_IMPL</p>
<div class="description">
<p>The highest thread priority. </p>
</div>
<h2>Constructors</h2>
<h3><a name="10821">Thread</a></h3>
<p class="decl"><a href="Poco.Thread.html" title="class Poco::Thread">Thread</a>();</p>
<div class="description">
<p>Creates a thread. Call <a href="Poco.Thread.html#10842" title="Poco::Thread::start()">start</a>() to start it. </p>
</div>
<h3><a name="10822">Thread</a></h3>
<p class="decl"><a href="Poco.Thread.html" title="class Poco::Thread">Thread</a>(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; name<br />);</p>
<div class="description">
<p>Creates a named thread. Call <a href="Poco.Thread.html#10842" title="Poco::Thread::start()">start</a>() to start it. </p>
</div>
<h2>Destructor</h2>
<h3><a name="10824">~Thread</a></h3>
<p class="decl">~<a href="Poco.Thread.html" title="class Poco::Thread">Thread</a>();</p>
<div class="description">
<p>Destroys the thread. </p>
</div>
<h2>Member Functions</h2>
<h3><a name="10856">current</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" />  <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static <a href="Poco.Thread.html" title="class Poco::Thread">Thread</a> * current();</p>
<div class="description">
<p>Returns the <a href="Poco.Thread.html" title="class Poco::Thread">Thread</a> object for the currently active thread. If the current thread is the main thread, 0 is returned. </p>
</div>
<h3><a name="10857">currentTid</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" />  <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static <a href="Poco.Thread.html#10813" title="Poco::Thread::TID">TID</a> currentTid();</p>
<div class="description">
<p>Returns the native thread ID for the current thread.     </p>
</div>
<h3><a name="10838">getMaxOSPriority</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" />  <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static int getMaxOSPriority();</p>
<div class="description">
<p>Returns the maximum operating system-specific priority value, which can be passed to <a href="Poco.Thread.html#10834" title="Poco::Thread::setOSPriority()">setOSPriority</a>(). </p>
</div>
<h3><a name="10837">getMinOSPriority</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" />  <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static int getMinOSPriority();</p>
<div class="description">
<p>Returns the mininum operating system-specific priority value, which can be passed to <a href="Poco.Thread.html#10834" title="Poco::Thread::setOSPriority()">setOSPriority</a>(). </p>
</div>
<h3><a name="10828">getName</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">std::string getName() const;</p>
<div class="description">
<p>Returns teh name of the thread. </p>
</div>
<h3><a name="10836">getOSPriority</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">int getOSPriority() const;</p>
<div class="description">
<p>Returns the thread's priority, expressed as an operating system specific priority value. </p>
</div>
<h3><a name="10833">getPriority</a></h3>
<p class="decl"><a href="Poco.Thread.html#10815" title="enum  Poco::Thread::Priority">Priority</a> getPriority() const;</p>
<div class="description">
<p>Returns the thread's priority. </p>
</div>
<h3><a name="10841">getStackSize</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">int getStackSize() const;</p>
<div class="description">
<p>Returns the thread's stack size in bytes. If the default stack size is used, 0 is returned. </p>
</div>
<h3><a name="10825">id</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">int id() const;</p>
<div class="description">
<p>Returns the unique thread ID of the thread. </p>
</div>
<h3><a name="10852">isRunning</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool isRunning() const;</p>
<div class="description">
<p>Returns true if the thread is running. </p>
</div>
<h3><a name="10847">join</a></h3>
<p class="decl">void join();</p>
<div class="description">
<p>Waits until the thread completes execution.	 If multiple threads try to join the same thread, the result is undefined. </p>
</div>
<h3><a name="10848">join</a></h3>
<p class="decl">void join(<br />&nbsp;&nbsp;&nbsp;&nbsp;long milliseconds<br />);</p>
<div class="description">
<p>Waits for at most the given interval for the thread to complete. Throws a <a href="Poco.TimeoutException.html" title="class Poco::TimeoutException">TimeoutException</a> if the thread does not complete within the specified time interval. </p>
</div>
<h3><a name="10827">name</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">std::string name() const;</p>
<div class="description">
<p>Returns the name of the thread. </p>
</div>
<h3><a name="10829">setName</a></h3>
<p class="decl">void setName(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; name<br />);</p>
<div class="description">
<p>Sets the name of the thread. </p>
</div>
<h3><a name="10834">setOSPriority</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void setOSPriority(<br />&nbsp;&nbsp;&nbsp;&nbsp;int prio<br />);</p>
<div class="description">
<p>Sets the thread's priority, using an operating system specific priority value. Use <a href="Poco.Thread.html#10837" title="Poco::Thread::getMinOSPriority()">getMinOSPriority</a>() and <a href="Poco.Thread.html#10838" title="Poco::Thread::getMaxOSPriority()">getMaxOSPriority</a>() to obtain mininum and maximum priority values. </p>
</div>
<h3><a name="10831">setPriority</a></h3>
<p class="decl">void setPriority(<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href="Poco.Thread.html#10815" title="enum  Poco::Thread::Priority">Priority</a> prio<br />);</p>
<div class="description">
<p>Sets the thread's priority. </p>
<p>Some platform only allow changing a thread's priority if the process has certain privileges. </p>
</div>
<h3><a name="10839">setStackSize</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void setStackSize(<br />&nbsp;&nbsp;&nbsp;&nbsp;int size<br />);</p>
<div class="description">
<p>Sets the thread's stack size in bytes. Setting the stack size to 0 will use the default stack size. Typically, the real stack size is rounded up to the nearest page size multiple. </p>
</div>
<h3><a name="10853">sleep</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" />  <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static void sleep(<br />&nbsp;&nbsp;&nbsp;&nbsp;long milliseconds<br />);</p>
<div class="description">
<p>Suspends the current thread for the specified amount of time. </p>
</div>
<h3><a name="10842">start</a></h3>
<p class="decl">void start(<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href="Poco.Runnable.html" title="class Poco::Runnable">Runnable</a> &amp; target<br />);</p>
<div class="description">
<p>Starts the thread with the given target. </p>
</div>
<h3><a name="10844">start</a></h3>
<p class="decl">void start(<br />&nbsp;&nbsp;&nbsp;&nbsp;Callable target,<br />&nbsp;&nbsp;&nbsp;&nbsp;void * pData = 0<br />);</p>
<div class="description">
<p>Starts the thread with the given target and parameter. </p>
</div>
<h3><a name="10826">tid</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.Thread.html#10813" title="Poco::Thread::TID">TID</a> tid() const;</p>
<div class="description">
<p>Returns the native thread ID of the thread. </p>
</div>
<h3><a name="10850">tryJoin</a></h3>
<p class="decl">bool tryJoin(<br />&nbsp;&nbsp;&nbsp;&nbsp;long milliseconds<br />);</p>
<div class="description">
<p>Waits for at most the given interval for the thread to complete. Returns true if the thread has finished, false otherwise. </p>
</div>
<h3><a name="10855">yield</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" />  <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static void yield();</p>
<div class="description">
<p>Yields cpu to other threads. </p>
</div>
<h3><a name="10859">clearTLS</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void clearTLS();</p>
<div class="description">
<p>Clears the thread's local storage. </p>
</div>
<h3><a name="10860">makeName</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">std::string makeName();</p>
<div class="description">
<p>Creates a unique name for a thread. </p>
</div>
<h3><a name="10858">tls</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.ThreadLocalStorage.html" title="class Poco::ThreadLocalStorage">ThreadLocalStorage</a> &amp; tls();</p>
<div class="description">
<p>Returns a reference to the thread's local storage. </p>
</div>
<h3><a name="10861">uniqueId</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" />  <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static int uniqueId();</p>
<div class="description">
<p>Creates and returns a unique id for a thread. </p>
</div>
<h2>Variables</h2>
<h3><a name="10814">ThreadImpl::Callable</a></h3>
<p class="decl">using ThreadImpl::Callable;</p>
<div class="description">
<p></p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright &copy; 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>

</div>
</body>
</html>