~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/threads-qtconcurrent.html

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- threads.qdoc -->
 
6
<head>
 
7
  <title>Qt 4.6: Concurrent Programming</title>
 
8
  <link rel="prev" href="threads-qobject.html" />
 
9
  <link rel="contents" href="threads.html" />
 
10
  <link rel="next" href="threads-modules.html" />
 
11
  <link href="classic.css" rel="stylesheet" type="text/css" />
 
12
</head>
 
13
<body>
 
14
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
15
<tr>
 
16
<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
 
17
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">All&nbsp;Functions</font></a>&nbsp;&middot; <a href="overviews.html"><font color="#004faf">Overviews</font></a></td><td class="searchBar" align="right" valign="center"><form action="http://www.google.com/cse" id="cse-search-box"><div><input type="hidden" name="cx" value="000136343326384750312:dhbxnqlakyu" /><input type="hidden" name="ie" value="UTF-8" /><input type="text" name="q" size="31" /><input type="submit" name="sa" value="Search" /></div></form></td>
 
18
</tr></table><p>
 
19
[Previous: <a href="threads-qobject.html">Threads and QObjects</a>]
 
20
[<a href="threads.html">Thread Support in Qt</a>]
 
21
[Next: <a href="threads-modules.html">Thread-Support in Qt Modules</a>]
 
22
</p>
 
23
<h1 class="title">Concurrent Programming<br /><span class="subtitle"></span>
 
24
</h1>
 
25
<a name="qtconcurrent-intro"></a><p>The <a href="qtconcurrent.html">QtConcurrent</a> namespace provides high-level APIs that make it possible to write multi-threaded programs without using low-level threading primitives such as mutexes, read-write locks, wait conditions, or semaphores. Programs written with <a href="qtconcurrent.html">QtConcurrent</a> automatically adjust the number of threads used according to the number of processor cores available. This means that applications written today will continue to scale when deployed on multi-core systems in the future.</p>
 
26
<p><a href="qtconcurrent.html">QtConcurrent</a> includes functional programming style APIs for parallel list processing, including a MapReduce and FilterReduce implementation for shared-memory (non-distributed) systems, and classes for managing asynchronous computations in GUI applications:</p>
 
27
<ul>
 
28
<li><a href="qtconcurrentmap.html#map">QtConcurrent::map</a>() applies a function to every item in a container, modifying the items in-place.</li>
 
29
<li><a href="qtconcurrentmap.html#mapped">QtConcurrent::mapped</a>() is like map(), except that it returns a new container with the modifications.</li>
 
30
<li><a href="qtconcurrentmap.html#mappedReduced">QtConcurrent::mappedReduced</a>() is like mapped(), except that the modified results are reduced or folded into a single result.</li>
 
31
<li><a href="qtconcurrentfilter.html#filter">QtConcurrent::filter</a>() removes all items from a container based on the result of a filter function.</li>
 
32
<li><a href="qtconcurrentfilter.html#filtered">QtConcurrent::filtered</a>() is like filter(), except that it returns a new container with the filtered results.</li>
 
33
<li><a href="qtconcurrentfilter.html#filteredReduced">QtConcurrent::filteredReduced</a>() is like filtered(), except that the filtered results are reduced or folded into a single result.</li>
 
34
<li><a href="qtconcurrentrun.html#run">QtConcurrent::run</a>() runs a function in another thread.</li>
 
35
<li><a href="qfuture.html">QFuture</a> represents the result of an asynchronous computation.</li>
 
36
<li><a href="qfutureiterator.html">QFutureIterator</a> allows iterating through results available via <a href="qfuture.html">QFuture</a>.</li>
 
37
<li><a href="qfuturewatcher.html">QFutureWatcher</a> allows monitoring a <a href="qfuture.html">QFuture</a> using signals-and-slots.</li>
 
38
<li><a href="qfuturesynchronizer.html">QFutureSynchronizer</a> is a convenience class that automatically synchronizes several QFutures.</li>
 
39
</ul>
 
40
<p>Qt Concurrent supports several STL-compatible container and iterator types, but works best with Qt containers that have random-access iterators, such as <a href="qlist.html">QList</a> or <a href="qvector.html">QVector</a>. The map and filter functions accept both containers and begin/end iterators.</p>
 
41
<p>STL Iterator support overview:</p>
 
42
<p><table class="generic" align="center" cellpadding="2" cellspacing="1" border="0">
 
43
<thead><tr valign="top" class="qt-style"><th>Iterator Type</th><th>Example classes</th><th>Support status</th></tr></thead>
 
44
<tr valign="top" class="odd"><td>Input Iterator</td><td></td><td>Not Supported</td></tr>
 
45
<tr valign="top" class="even"><td>Output Iterator</td><td></td><td>Not Supported</td></tr>
 
46
<tr valign="top" class="odd"><td>Forward Iterator</td><td>std::slist</td><td>Supported</td></tr>
 
47
<tr valign="top" class="even"><td>Bidirectional Iterator</td><td><a href="qlinkedlist.html">QLinkedList</a>, std::list</td><td>Supported</td></tr>
 
48
<tr valign="top" class="odd"><td>Random Access Iterator</td><td><a href="qlist.html">QList</a>, <a href="qvector.html">QVector</a>, std::vector</td><td>Supported and Recommended</td></tr>
 
49
</table></p>
 
50
<p>Random access iterators can be faster in cases where Qt Concurrent is iterating over a large number of lightweight items, since they allow skipping to any point in the container. In addition, using random access iterators allows Qt Concurrent to provide progress information trough <a href="qfuture.html#progressValue">QFuture::progressValue</a>() and QFutureWatcher:: progressValueChanged().</p>
 
51
<p>The non in-place modifying functions such as mapped() and filtered() makes a copy of the container when called. If you are using STL containers this copy operation might take some time, in this case we recommend specifying the begin and end iterators for the container instead.</p>
 
52
<p>
 
53
[Previous: <a href="threads-qobject.html">Threads and QObjects</a>]
 
54
[<a href="threads.html">Thread Support in Qt</a>]
 
55
[Next: <a href="threads-modules.html">Thread-Support in Qt Modules</a>]
 
56
</p>
 
57
<p /><address><hr /><div align="center">
 
58
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
59
<td width="40%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
 
60
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
61
<td width="40%" align="right"><div align="right">Qt 4.6.0</div></td>
 
62
<script type="text/javascript" src="http://www.google.com/jsapi"></script><script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script><script type="text/javascript" src="http://www.google.com/coop/cse/t13n?form=cse-search-box&t13n_langs=en"></script><script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script></tr></table></div></address></body>
 
63
</html>