File: threads.html

package info (click to toggle)
python-qt4 4.9.3-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 34,432 kB
  • sloc: python: 34,126; cpp: 11,938; xml: 290; makefile: 223; php: 27
file content (247 lines) | stat: -rw-r--r-- 8,591 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
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>Thread Support in Qt</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><p class="naviNextPrevious headerNavi"><a class="nextPage" href="threads-starting.html">Starting Threads with QThread</a></p>
<div class="toc">
<h3><a id="toc" name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#topics">Topics:</a></li>
<li class="level1"><a href="#recommended-reading">Recommended
Reading</a></li>
<li class="level1"><a href="#the-threading-classes">The Threading
Classes</a></li>
</ul>
</div>
<h1 class="title">Thread Support in Qt</h1>

<div class="descr"><a id="details" name="details" />
<p>Qt provides thread support in the form of platform-independent
threading classes, a thread-safe way of posting events, and
signal-slot connections across threads. This makes it easy to
develop portable multithreaded Qt applications and take advantage
of multiprocessor machines. Multithreaded programming is also a
useful paradigm for performing time-consuming operations without
freezing the user interface of an application.</p>
<p>Earlier versions of Qt offered an option to build the library
without thread support. Since Qt 4.0, threads are always
enabled.</p>
<a id="topics" name="topics" />
<h2>Topics:</h2>
<ul>
<li><a href="#recommended-reading">Recommended Reading</a></li>
<li><a href="#the-threading-classes">The Threading Classes</a></li>
<li><a href="threads-starting.html">Starting Threads with
QThread</a></li>
<li><a href="threads-synchronizing.html">Synchronizing
Threads</a></li>
<li><a href="threads-reentrancy.html">Reentrancy and
Thread-Safety</a></li>
<li><a href="threads-qobject.html">Threads and QObjects</a></li>
<li><a href="threads-qtconcurrent.html">Concurrent
Programming</a></li>
<li><a href="threads-modules.html">Thread-Support in Qt
Modules</a></li>
</ul>
<a id="recommended-reading" name="recommended-reading" />
<h2>Recommended Reading</h2>
<p>This document is intended for an audience that has knowledge of,
and experience with, multithreaded applications. If you are new to
threading see our Recommended Reading list:</p>
<ul>
<li><a href="http://www.amazon.com/exec/obidos/ASIN/0134436989/trolltech/t">Threads
Primer: A Guide to Multithreaded Programming</a></li>
<li><a href="http://www.amazon.com/exec/obidos/ASIN/0131900676/trolltech/t">Thread
Time: The Multithreaded Programming Guide</a></li>
<li><a href="http://www.amazon.com/exec/obidos/ASIN/1565921151/trolltech/t">Pthreads
Programming: A POSIX Standard for Better Multiprocessing</a></li>
<li><a href="http://www.amazon.com/exec/obidos/ASIN/1565922964/trolltech/t">Win32
Multithreaded Programming</a></li>
</ul>
<a id="the-threading-classes" name="the-threading-classes" />
<h2>The Threading Classes</h2>
<p>These classes are relevant to threaded applications.</p>
<table class="annotated">
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qtconcurrentrun.html">Asynchronous Run</a></p>
</td>
<td class="tblDescr">
<p>The &lt;QtConcurrentRun&gt; header provides a way to run a
function in a separate thread.</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qtconcurrentfilter.html">Concurrent Filter and
Filter-Reduce</a></p>
</td>
<td class="tblDescr">
<p>The &lt;QtConcurrentFilter&gt; header provides concurrent Filter
and Filter-Reduce.</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qtconcurrentmap.html">Concurrent Map and
Map-Reduce</a></p>
</td>
<td class="tblDescr">
<p>The &lt;QtConcurrentMap&gt; header provides concurrent Map and
MapReduce.</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qatomicint.html">QAtomicInt</a></p>
</td>
<td class="tblDescr">
<p>Platform-independent atomic operations on integers</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qatomicpointer.html">QAtomicPointer</a></p>
</td>
<td class="tblDescr">
<p>Template class that provides platform-independent atomic
operations on pointers</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qfuture.html">QFuture</a></p>
</td>
<td class="tblDescr">
<p>Represents the result of an asynchronous computation</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qfuturesynchronizer.html">QFutureSynchronizer</a></p>
</td>
<td class="tblDescr">
<p>Convenience class that simplifies QFuture synchronization</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qfuturewatcher.html">QFutureWatcher</a></p>
</td>
<td class="tblDescr">
<p>Allows monitoring a QFuture using signals and slots</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qmutex.html">QMutex</a></p>
</td>
<td class="tblDescr">
<p>Access serialization between threads</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qmutexlocker.html">QMutexLocker</a></p>
</td>
<td class="tblDescr">
<p>Convenience class that simplifies locking and unlocking
mutexes</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qreadlocker.html">QReadLocker</a></p>
</td>
<td class="tblDescr">
<p>Convenience class that simplifies locking and unlocking
read-write locks for read access</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qreadwritelock.html">QReadWriteLock</a></p>
</td>
<td class="tblDescr">
<p>Read-write locking</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qrunnable.html">QRunnable</a></p>
</td>
<td class="tblDescr">
<p>The base class for all runnable objects</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qsemaphore.html">QSemaphore</a></p>
</td>
<td class="tblDescr">
<p>General counting semaphore</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qthread.html">QThread</a></p>
</td>
<td class="tblDescr">
<p>Platform-independent threads</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qthreadpool.html">QThreadPool</a></p>
</td>
<td class="tblDescr">
<p>Manages a collection of QThreads</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qthreadstorage.html">QThreadStorage</a></p>
</td>
<td class="tblDescr">
<p>Per-thread data storage</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qwaitcondition.html">QWaitCondition</a></p>
</td>
<td class="tblDescr">
<p>Condition variable for synchronizing threads</p>
</td>
</tr>
<tr class="odd topAlign">
<td class="tblName">
<p><a href="qwritelocker.html">QWriteLocker</a></p>
</td>
<td class="tblDescr">
<p>Convenience class that simplifies locking and unlocking
read-write locks for write access</p>
</td>
</tr>
<tr class="even topAlign">
<td class="tblName">
<p><a href="qtconcurrent.html">QtConcurrent</a></p>
</td>
<td class="tblDescr">
<p>High-level APIs that make it possible to write multi-threaded
programs without using low-level threading primitives</p>
</td>
</tr>
</table>
<p><b>Note:</b> Qt's threading classes are implemented with native
threading APIs; e.g., Win32 and pthreads. Therefore, they can be
used with threads of the same native API.</p>
</div>

<p class="naviNextPrevious footerNavi"><a class="nextPage" href="threads-starting.html">Starting Threads with QThread</a></p>
<div class="ft" />
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.2</td></tr></table></div></address></body></html>