summaryrefslogtreecommitdiffstats
path: root/src/concurrent
diff options
context:
space:
mode:
Diffstat (limited to 'src/concurrent')
-rw-r--r--src/concurrent/concurrent.pro2
-rw-r--r--src/concurrent/doc/qtconcurrent.qdocconf2
-rw-r--r--src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp4
-rw-r--r--src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp4
-rw-r--r--src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp2
-rw-r--r--src/concurrent/qtconcurrentfilter.cpp28
-rw-r--r--src/concurrent/qtconcurrentmap.cpp34
-rw-r--r--src/concurrent/qtconcurrentmedian.h4
-rw-r--r--src/concurrent/qtconcurrentrun.cpp26
9 files changed, 34 insertions, 72 deletions
diff --git a/src/concurrent/concurrent.pro b/src/concurrent/concurrent.pro
index 53b6bd0472..2b8fef2d6a 100644
--- a/src/concurrent/concurrent.pro
+++ b/src/concurrent/concurrent.pro
@@ -39,5 +39,5 @@ HEADERS += \
HEADERS += \
contains(QT_CONFIG, clock-gettime) {
- linux-*|hpux-*|solaris-*:LIBS *= -lrt
+ linux-*|hpux-*|solaris-*: LIBS_PRIVATE *= -lrt
}
diff --git a/src/concurrent/doc/qtconcurrent.qdocconf b/src/concurrent/doc/qtconcurrent.qdocconf
index 9d89192946..e45047cb51 100644
--- a/src/concurrent/doc/qtconcurrent.qdocconf
+++ b/src/concurrent/doc/qtconcurrent.qdocconf
@@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtConcurrent
description = Qt Concurrent Reference Documentation
-url = http://qt-project.org/doc/qt-$QT_VER/qtconcurrent
+url = http://qt-project.org/doc/qt-$QT_VER
version = $QT_VERSION
examplesinstallpath = qtconcurrent
diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
index 7160f80b34..9afcdc9740 100644
--- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
+++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
@@ -136,7 +136,7 @@ bool QString::contains(const QRegExp &regexp) const;
//! [10]
-boost::bind(&QString::contains, QRegExp("^\\S+$")); // matches strings without whitespace
+std::bind(&QString::contains, QRegExp("^\\S+$")); // matches strings without whitespace
//! [10]
@@ -147,7 +147,7 @@ bool contains(const QString &string)
//! [12]
QStringList strings = ...;
-boost::bind(static_cast<bool(QString::*)(const QRegExp&)>( &QString::contains ), QRegExp("..." ));
+std::bind(static_cast<bool(QString::*)(const QRegExp&)>( &QString::contains ), QRegExp("..." ));
//! [12]
//! [13]
diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp
index 756ca3902c..634c03e808 100644
--- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp
+++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp
@@ -149,7 +149,7 @@ QImage QImage::scaledToWidth(int width, Qt::TransformationMode) const;
//! [11]
-boost::bind(&QImage::scaledToWidth, 100, Qt::SmoothTransformation)
+std::bind(&QImage::scaledToWidth, 100, Qt::SmoothTransformation)
//! [11]
@@ -160,7 +160,7 @@ QImage scaledToWith(const QImage &image)
//! [13]
QList<QImage> images = ...;
-QFuture<QImage> thumbnails = QtConcurrent::mapped(images, boost::bind(&QImage::scaledToWidth, 100 Qt::SmoothTransformation));
+QFuture<QImage> thumbnails = QtConcurrent::mapped(images, std::bind(&QImage::scaledToWidth, 100 Qt::SmoothTransformation));
//! [13]
//! [14]
diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp
index 7288fc642b..8922e41f34 100644
--- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp
+++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp
@@ -93,6 +93,6 @@ future.waitForFinished();
//! [6]
void someFunction(int arg1, double arg2);
-QFuture<void> future = QtConcurrent::run(boost::bind(someFunction, 1, 2.0));
+QFuture<void> future = QtConcurrent::run(std::bind(someFunction, 1, 2.0));
...
//! [6]
diff --git a/src/concurrent/qtconcurrentfilter.cpp b/src/concurrent/qtconcurrentfilter.cpp
index 22a1243c18..ab0227983d 100644
--- a/src/concurrent/qtconcurrentfilter.cpp
+++ b/src/concurrent/qtconcurrentfilter.cpp
@@ -40,15 +40,10 @@
****************************************************************************/
/*!
- \headerfile <QtConcurrentFilter>
+ \page qtconcurrentfilter.html
\title Concurrent Filter and Filter-Reduce
\ingroup thread
- \brief The <QtConcurrentFilter> header provides concurrent Filter and
- Filter-Reduce.
-
- These functions are a part of the \l {Qt Concurrent} framework.
-
The QtConcurrent::filter(), QtConcurrent::filtered() and
QtConcurrent::filteredReduced() functions filter items in a sequence such
as a QList or a QVector in parallel. QtConcurrent::filter() modifies a
@@ -56,6 +51,8 @@
containing the filtered content, and QtConcurrent::filteredReduced()
returns a single result.
+ These functions are a part of the \l {Qt Concurrent} framework.
+
Each of the above functions have a blocking variant that returns the final
result instead of a QFuture. You use them in the same way as the
asynchronous variants.
@@ -155,15 +152,11 @@
\section2 Using Bound Function Arguments
- Note that Qt does not provide support for bound functions. This is
- provided by 3rd party libraries like
- \l{http://www.boost.org/libs/bind/bind.html}{Boost} or
- \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}
- {C++ TR1 Library Extensions}.
-
If you want to use a filter function takes more than one argument, you can
- use boost::bind() or std::tr1::bind() to transform it onto a function that
- takes one argument.
+ use std::bind() to transform it onto a function that takes one argument. If
+ C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html}
+ {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}
+ {std::tr1::bind()} are suitable replacements.
As an example, we use QString::contains():
@@ -177,7 +170,7 @@
\snippet code/src_concurrent_qtconcurrentfilter.cpp 10
- The return value from boost::bind() is a function object (functor) with
+ The return value from std::bind() is a function object (functor) with
the following signature:
\snippet code/src_concurrent_qtconcurrentfilter.cpp 11
@@ -190,7 +183,6 @@
/*!
\fn QFuture<void> QtConcurrent::filter(Sequence &sequence, FilterFunction filterFunction)
- \relates <QtConcurrentFilter>
Calls \a filterFunction once for each item in \a sequence. If
\a filterFunction returns \c true, the item is kept in \a sequence;
@@ -199,7 +191,6 @@
/*!
\fn QFuture<T> QtConcurrent::filtered(const Sequence &sequence, FilterFunction filterFunction)
- \relates <QtConcurrentFilter>
Calls \a filterFunction once for each item in \a sequence and returns a
new Sequence of kept items. If \a filterFunction returns \c true, a copy of
@@ -209,7 +200,6 @@
/*!
\fn QFuture<T> QtConcurrent::filtered(ConstIterator begin, ConstIterator end, FilterFunction filterFunction)
- \relates <QtConcurrentFilter>
Calls \a filterFunction once for each item from \a begin to \a end and
returns a new Sequence of kept items. If \a filterFunction returns \c true, a
@@ -219,7 +209,6 @@
/*!
\fn QFuture<T> QtConcurrent::filteredReduced(const Sequence &sequence, FilterFunction filterFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
- \relates <QtConcurrentFilter>
Calls \a filterFunction once for each item in \a sequence. If
\a filterFunction returns \c true for an item, that item is then passed to
@@ -236,7 +225,6 @@
/*!
\fn QFuture<T> QtConcurrent::filteredReduced(ConstIterator begin, ConstIterator end, FilterFunction filterFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
- \relates <QtConcurrentFilter>
Calls \a filterFunction once for each item from \a begin to \a end. If
\a filterFunction returns \c true for an item, that item is then passed to
diff --git a/src/concurrent/qtconcurrentmap.cpp b/src/concurrent/qtconcurrentmap.cpp
index da2a601ae2..fc904a4d59 100644
--- a/src/concurrent/qtconcurrentmap.cpp
+++ b/src/concurrent/qtconcurrentmap.cpp
@@ -68,14 +68,10 @@
*/
/*!
- \headerfile <QtConcurrentMap>
+ \page qtconcurrentmap.html
\title Concurrent Map and Map-Reduce
\ingroup thread
- \brief The <QtConcurrentMap> header provides concurrent Map and MapReduce.
-
- These functions are a part of the \l {Qt Concurrent} framework.
-
The QtConcurrent::map(), QtConcurrent::mapped() and
QtConcurrent::mappedReduced() functions run computations in parallel on
the items in a sequence such as a QList or a QVector. QtConcurrent::map()
@@ -83,6 +79,8 @@
sequence containing the modified content, and QtConcurrent::mappedReduced()
returns a single result.
+ These functions are a part of the \l {Qt Concurrent} framework.
+
Each of the above functions has a blocking variant that returns
the final result instead of a QFuture. You use them in the same
way as the asynchronous variants.
@@ -204,15 +202,11 @@
\section2 Using Bound Function Arguments
- Note that Qt does not provide support for bound functions. This is
- provided by 3rd party libraries like
- \l{http://www.boost.org/libs/bind/bind.html}{Boost} or
- \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}{C++
- TR1 Library Extensions}.
-
If you want to use a map function that takes more than one argument you can
- use boost::bind() or std::tr1::bind() to transform it onto a function that
- takes one argument.
+ use std::bind() to transform it onto a function that takes one argument. If
+ C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html}
+ {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}
+ {std::tr1::bind()} are suitable replacements.
As an example, we'll use QImage::scaledToWidth():
@@ -226,7 +220,7 @@
\snippet code/src_concurrent_qtconcurrentmap.cpp 11
- The return value from boost::bind() is a function object (functor) with
+ The return value from std::bind() is a function object (functor) with
the following signature:
\snippet code/src_concurrent_qtconcurrentmap.cpp 12
@@ -239,7 +233,6 @@
/*!
\fn QFuture<void> QtConcurrent::map(Sequence &sequence, MapFunction function)
- \relates <QtConcurrentMap>
Calls \a function once for each item in \a sequence. The \a function is
passed a reference to the item, so that any modifications done to the item
@@ -248,7 +241,6 @@
/*!
\fn QFuture<void> QtConcurrent::map(Iterator begin, Iterator end, MapFunction function)
- \relates <QtConcurrentMap>
Calls \a function once for each item from \a begin to \a end. The
\a function is passed a reference to the item, so that any modifications
@@ -257,7 +249,6 @@
/*!
\fn QFuture<T> QtConcurrent::mapped(const Sequence &sequence, MapFunction function)
- \relates <QtConcurrentMap>
Calls \a function once for each item in \a sequence and returns a future
with each mapped item as a result. You can use QFuture::const_iterator or
@@ -266,7 +257,6 @@
/*!
\fn QFuture<T> QtConcurrent::mapped(ConstIterator begin, ConstIterator end, MapFunction function)
- \relates <QtConcurrentMap>
Calls \a function once for each item from \a begin to \a end and returns a
future with each mapped item as a result. You can use
@@ -278,8 +268,6 @@
MapFunction mapFunction, ReduceFunction reduceFunction,
QtConcurrent::ReduceOptions reduceOptions)
- \relates <QtConcurrentMap>
-
Calls \a mapFunction once for each item in \a sequence. The return value of
each \a mapFunction is passed to \a reduceFunction.
@@ -293,8 +281,6 @@
ConstIterator end, MapFunction mapFunction, ReduceFunction reduceFunction,
QtConcurrent::ReduceOptions reduceOptions)
- \relates <QtConcurrentMap>
-
Calls \a mapFunction once for each item from \a begin to \a end. The return
value of each \a mapFunction is passed to \a reduceFunction.
@@ -361,8 +347,6 @@
/*!
\fn T QtConcurrent::blockingMappedReduced(const Sequence &sequence, MapFunction mapFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
- \relates <QtConcurrentMap>
-
Calls \a mapFunction once for each item in \a sequence. The return value of
each \a mapFunction is passed to \a reduceFunction.
@@ -378,8 +362,6 @@
/*!
\fn T QtConcurrent::blockingMappedReduced(ConstIterator begin, ConstIterator end, MapFunction mapFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
- \relates <QtConcurrentMap>
-
Calls \a mapFunction once for each item from \a begin to \a end. The return
value of each \a mapFunction is passed to \a reduceFunction.
diff --git a/src/concurrent/qtconcurrentmedian.h b/src/concurrent/qtconcurrentmedian.h
index 29342e6402..b39b3ed32b 100644
--- a/src/concurrent/qtconcurrentmedian.h
+++ b/src/concurrent/qtconcurrentmedian.h
@@ -90,7 +90,7 @@ public:
dirty = true;
}
- values[currentIndex] = qMove(value);
+ values[currentIndex] = value;
}
bool isMedianValid() const
@@ -105,7 +105,7 @@ public:
QVector<T> copy = values;
typename QVector<T>::iterator begin = copy.begin(), mid = copy.begin() + bufferSize/2, end = copy.end();
std::nth_element(begin, mid, end);
- currentMedian = qMove(*mid);
+ currentMedian = *mid;
}
return currentMedian;
}
diff --git a/src/concurrent/qtconcurrentrun.cpp b/src/concurrent/qtconcurrentrun.cpp
index 4398e1a91f..c71fc9048f 100644
--- a/src/concurrent/qtconcurrentrun.cpp
+++ b/src/concurrent/qtconcurrentrun.cpp
@@ -40,19 +40,15 @@
****************************************************************************/
/*!
- \headerfile <QtConcurrentRun>
- \title Asynchronous Run
-
- \brief The <QtConcurrentRun> header provides a way to run a function in a
- separate thread.
-
+ \page qtconcurrentrun.html
+ \title Concurrent Run
\ingroup thread
- This function is a part of the \l {Qt Concurrent} framework.
-
The QtConcurrent::run() function runs a function in a separate thread.
The return value of the function is made available through the QFuture API.
+ This function is a part of the \l {Qt Concurrent} framework.
+
\section1 Running a Function in a Separate Thread
To run a function in another thread, use QtConcurrent::run():
@@ -110,15 +106,12 @@
\section2 Using Bound Function Arguments
- Note that Qt does not provide support for bound functions. This is
- provided by 3rd party libraries like
- \l{http://www.boost.org/libs/bind/bind.html}{Boost} or
- \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}
- {C++ TR1 Library Extensions}.
+ You can use std::bind() to \e bind a number of arguments to a function when
+ called. If C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html}
+ {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}
+ {std::tr1::bind()} are suitable replacements.
- You can use boost::bind() or std::tr1::bind() to \e bind a number of
- arguments to a function when called. There are number of reasons for doing
- this:
+ There are number of reasons for binding:
\list
\li To call a function that takes more than 5 arguments.
@@ -136,7 +129,6 @@
/*!
\fn QFuture<T> QtConcurrent::run(Function function, ...);
- \relates <QtConcurrentRun>
Runs \a function in a separate thread. The thread is taken from the global
QThreadPool. Note that the function may not run immediately; the function