Move QFuture from QtConcurrent to QtCore

This class belongs to QThreadPool/QRunnable more than to QtConcurrent, so
move to QtCore, where QThreadPool awaits it.

Change-Id: Ibf20288a986593bf779453427c2dae8db1e1423a
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2012-08-27 18:33:55 +02:00 committed by The Qt Project
parent f7a33ec29f
commit 727f25214e
21 changed files with 24 additions and 33 deletions

View File

@ -12,8 +12,6 @@ load(qt_module)
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
SOURCES += \ SOURCES += \
qfuture.cpp \
qfutureinterface.cpp \
qfuturesynchronizer.cpp \ qfuturesynchronizer.cpp \
qfuturewatcher.cpp \ qfuturewatcher.cpp \
qtconcurrentfilter.cpp \ qtconcurrentfilter.cpp \
@ -23,8 +21,6 @@ SOURCES += \
HEADERS += \ HEADERS += \
qtconcurrent_global.h \ qtconcurrent_global.h \
qfuture.h \
qfutureinterface.h \
qfuturesynchronizer.h \ qfuturesynchronizer.h \
qfuturewatcher.h \ qfuturewatcher.h \
qtconcurrentcompilertest.h \ qtconcurrentcompilertest.h \
@ -44,7 +40,6 @@ HEADERS += \
# private headers # private headers
HEADERS += \ HEADERS += \
qfutureinterface_p.h \
qfuturewatcher_p.h qfuturewatcher_p.h
QMAKE_DOCS = $$PWD/doc/qtconcurrent.qdocconf QMAKE_DOCS = $$PWD/doc/qtconcurrent.qdocconf

View File

@ -44,7 +44,7 @@
#include <QtConcurrent/qtconcurrent_global.h> #include <QtConcurrent/qtconcurrent_global.h>
#include <QtConcurrent/qfuture.h> #include <QtCore/qfuture.h>
#ifndef QT_NO_CONCURRENT #ifndef QT_NO_CONCURRENT

View File

@ -44,7 +44,7 @@
#include <QtConcurrent/qtconcurrent_global.h> #include <QtConcurrent/qtconcurrent_global.h>
#include <QtConcurrent/qfuture.h> #include <QtCore/qfuture.h>
#ifndef QT_NO_QFUTURE #ifndef QT_NO_QFUTURE

View File

@ -55,7 +55,7 @@
#include <QtConcurrent/qtconcurrent_global.h> #include <QtConcurrent/qtconcurrent_global.h>
#include "qfutureinterface_p.h" #include <private/qfutureinterface_p.h>
#include <qlist.h> #include <qlist.h>
#ifndef QT_NO_QFUTURE #ifndef QT_NO_QFUTURE

View File

@ -47,10 +47,6 @@
QT_BEGIN_HEADER QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifdef QT_NO_CONCURRENT
# define QT_NO_QFUTURE
#endif
#ifndef QT_STATIC #ifndef QT_STATIC
# if defined(QT_BUILD_CONCURRENT_LIB) # if defined(QT_BUILD_CONCURRENT_LIB)
# define Q_CONCURRENT_EXPORT Q_DECL_EXPORT # define Q_CONCURRENT_EXPORT Q_DECL_EXPORT

View File

@ -46,7 +46,7 @@
#ifndef QT_NO_CONCURRENT #ifndef QT_NO_CONCURRENT
#include <QtConcurrent/qfuture.h> #include <QtCore/qfuture.h>
#include <QtCore/qrunnable.h> #include <QtCore/qrunnable.h>
#include <QtCore/qthreadpool.h> #include <QtCore/qthreadpool.h>

View File

@ -47,7 +47,7 @@
#ifndef QT_NO_CONCURRENT #ifndef QT_NO_CONCURRENT
#include <QtCore/qthreadpool.h> #include <QtCore/qthreadpool.h>
#include <QtConcurrent/qfuture.h> #include <QtCore/qfuture.h>
#include <QtCore/qdebug.h> #include <QtCore/qdebug.h>
#include <QtCore/qexception.h> #include <QtCore/qexception.h>
#include <QtCore/qwaitcondition.h> #include <QtCore/qwaitcondition.h>

View File

@ -42,11 +42,11 @@
#ifndef QFUTURE_H #ifndef QFUTURE_H
#define QFUTURE_H #define QFUTURE_H
#include <QtConcurrent/qtconcurrent_global.h> #include <QtCore/qglobal.h>
#ifndef QT_NO_QFUTURE #ifndef QT_NO_QFUTURE
#include <QtConcurrent/qfutureinterface.h> #include <QtCore/qfutureinterface.h>
#include <QtCore/qstring.h> #include <QtCore/qstring.h>
QT_BEGIN_HEADER QT_BEGIN_HEADER

View File

@ -374,7 +374,7 @@
QFuture::constBegin() or QFuture::constEnd() before you start iterating. QFuture::constBegin() or QFuture::constEnd() before you start iterating.
Here's a typical loop that prints all the results available in a future: Here's a typical loop that prints all the results available in a future:
\snippet code/src_concurrent_qfuture.cpp 0 \snippet code/src_corelib_thread_qfuture.cpp 0
\sa QFutureIterator, QFuture \sa QFutureIterator, QFuture
*/ */
@ -555,7 +555,7 @@
list (i.e. before the first result). Here's how to iterate over all the list (i.e. before the first result). Here's how to iterate over all the
results sequentially: results sequentially:
\snippet code/src_concurrent_qfuture.cpp 1 \snippet code/src_corelib_thread_qfuture.cpp 1
The next() function returns the next result (waiting for it to become The next() function returns the next result (waiting for it to become
available, if necessary) from the future and advances the iterator. Unlike available, if necessary) from the future and advances the iterator. Unlike
@ -570,7 +570,7 @@
Here's how to iterate over the elements in reverse order: Here's how to iterate over the elements in reverse order:
\snippet code/src_concurrent_qfuture.cpp 2 \snippet code/src_corelib_thread_qfuture.cpp 2
If you want to find all occurrences of a particular value, use findNext() If you want to find all occurrences of a particular value, use findNext()
or findPrevious() in a loop. or findPrevious() in a loop.

View File

@ -562,4 +562,4 @@ void QFutureInterfaceBasePrivate::setState(QFutureInterfaceBase::State newState)
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_CONCURRENT #endif // QT_NO_QFUTURE

View File

@ -42,8 +42,6 @@
#ifndef QFUTUREINTERFACE_H #ifndef QFUTUREINTERFACE_H
#define QFUTUREINTERFACE_H #define QFUTUREINTERFACE_H
#include <QtConcurrent/qtconcurrent_global.h>
#include <QtCore/qrunnable.h> #include <QtCore/qrunnable.h>
#ifndef QT_NO_QFUTURE #ifndef QT_NO_QFUTURE
@ -61,7 +59,7 @@ class QFutureInterfaceBasePrivate;
class QFutureWatcherBase; class QFutureWatcherBase;
class QFutureWatcherBasePrivate; class QFutureWatcherBasePrivate;
class Q_CONCURRENT_EXPORT QFutureInterfaceBase class Q_CORE_EXPORT QFutureInterfaceBase
{ {
public: public:
enum State { enum State {
@ -308,6 +306,6 @@ public:
QT_END_NAMESPACE QT_END_NAMESPACE
QT_END_HEADER QT_END_HEADER
#endif // QT_NO_CONCURRENT #endif // QT_NO_QFUTURE
#endif // QFUTUREINTERFACE_H #endif // QFUTUREINTERFACE_H

View File

@ -53,8 +53,6 @@
// We mean it. // We mean it.
// //
#include <QtConcurrent/qtconcurrent_global.h>
#include <QtCore/qelapsedtimer.h> #include <QtCore/qelapsedtimer.h>
#include <QtCore/qcoreevent.h> #include <QtCore/qcoreevent.h>
#include <QtCore/qlist.h> #include <QtCore/qlist.h>
@ -126,7 +124,7 @@ public:
virtual void callOutInterfaceDisconnected() = 0; virtual void callOutInterfaceDisconnected() = 0;
}; };
class QFutureInterfaceBasePrivate class Q_CORE_EXPORT QFutureInterfaceBasePrivate // ### temporary
{ {
public: public:
QFutureInterfaceBasePrivate(QFutureInterfaceBase::State initialState); QFutureInterfaceBasePrivate(QFutureInterfaceBase::State initialState);

View File

@ -12,6 +12,8 @@ HEADERS += thread/qmutex.h \
thread/qatomic.h \ thread/qatomic.h \
thread/qexception.h \ thread/qexception.h \
thread/qresultstore.h \ thread/qresultstore.h \
thread/qfuture.h \
thread/qfutureinterface.h \
thread/qbasicatomic.h \ thread/qbasicatomic.h \
thread/qgenericatomic.h \ thread/qgenericatomic.h \
thread/qoldbasicatomic.h thread/qoldbasicatomic.h
@ -19,6 +21,7 @@ HEADERS += thread/qmutex.h \
# private headers # private headers
HEADERS += thread/qmutex_p.h \ HEADERS += thread/qmutex_p.h \
thread/qmutexpool_p.h \ thread/qmutexpool_p.h \
thread/qfutureinterface_p.h \
thread/qorderedmutexlocker_p.h \ thread/qorderedmutexlocker_p.h \
thread/qreadwritelock_p.h \ thread/qreadwritelock_p.h \
thread/qthread_p.h \ thread/qthread_p.h \
@ -27,6 +30,7 @@ HEADERS += thread/qmutex_p.h \
SOURCES += thread/qatomic.cpp \ SOURCES += thread/qatomic.cpp \
thread/qexception.cpp \ thread/qexception.cpp \
thread/qresultstore.cpp \ thread/qresultstore.cpp \
thread/qfutureinterface.cpp \
thread/qmutex.cpp \ thread/qmutex.cpp \
thread/qreadwritelock.cpp \ thread/qreadwritelock.cpp \
thread/qrunnable.cpp \ thread/qrunnable.cpp \

View File

@ -1,6 +1,5 @@
TEMPLATE=subdirs TEMPLATE=subdirs
SUBDIRS=\ SUBDIRS=\
qfuture \
qfuturesynchronizer \ qfuturesynchronizer \
qfuturewatcher \ qfuturewatcher \
qtconcurrentfilter \ qtconcurrentfilter \

View File

@ -42,7 +42,7 @@
#include <QtTest> #include <QtTest>
#include <QtConcurrent/qfuturesynchronizer.h> #include <QtConcurrent/qfuturesynchronizer.h>
#include <QtConcurrent/qfuture.h> #include <QtCore/qfuture.h>
class tst_QFutureSynchronizer : public QObject class tst_QFutureSynchronizer : public QObject
{ {

View File

@ -1,5 +1,5 @@
CONFIG += testcase parallel_test CONFIG += testcase parallel_test
TARGET = tst_qfuturewatcher TARGET = tst_qfuturewatcher
QT = core concurrent-private testlib concurrent QT = core core-private testlib concurrent
SOURCES = tst_qfuturewatcher.cpp SOURCES = tst_qfuturewatcher.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -1,6 +1,6 @@
CONFIG += testcase parallel_test CONFIG += testcase parallel_test
TARGET = tst_qfuture TARGET = tst_qfuture
QT = core concurrent-private testlib concurrent QT = core core-private testlib concurrent
SOURCES = tst_qfuture.cpp SOURCES = tst_qfuture.cpp
DEFINES += QT_STRICT_ITERATORS DEFINES += QT_STRICT_ITERATORS
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -1297,8 +1297,8 @@ QFuture<int> createExceptionResultFuture()
class DerivedException : public QException class DerivedException : public QException
{ {
public: public:
void raise() const { throw *this; } void raise() const Q_DECL_OVERRIDE { throw *this; }
DerivedException *clone() const { return new DerivedException(*this); } DerivedException *clone() const Q_DECL_OVERRIDE { return new DerivedException(*this); }
}; };
QFuture<void> createDerivedExceptionFuture() QFuture<void> createDerivedExceptionFuture()

View File

@ -3,6 +3,7 @@ SUBDIRS=\
qatomicint \ qatomicint \
qatomicpointer \ qatomicpointer \
qresultstore \ qresultstore \
qfuture \
qmutex \ qmutex \
qmutexlocker \ qmutexlocker \
qreadlocker \ qreadlocker \