From 96501b0a18f4f70048403dccc4cb42dd71db8f9d Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 3 Feb 2012 14:17:26 +0100 Subject: [PATCH] Move QtConcurrent into its own module Task-number: QTBUG-20892 Change-Id: I614500aafb6428915509983608bbb0ade4e4f016 Reviewed-by: Thiago Macieira --- bin/fixqt4headers.pl | 1 + .../qtconcurrent/imagescaling/imagescaling.h | 1 + .../imagescaling/imagescaling.pro | 1 + examples/qtconcurrent/imagescaling/main.cpp | 1 + examples/qtconcurrent/map/map.pro | 3 +- examples/qtconcurrent/progressdialog/main.cpp | 1 + .../progressdialog/progressdialog.pro | 2 +- .../qtconcurrent/runfunction/runfunction.pro | 2 +- examples/qtconcurrent/wordcount/wordcount.pro | 2 +- .../helloconcurrent/helloconcurrent.cpp | 2 + .../helloconcurrent/helloconcurrent.pro | 1 + src/concurrent/concurrent.pro | 59 +++++++++++++ src/{corelib => }/concurrent/qfuture.cpp | 0 src/{corelib => }/concurrent/qfuture.h | 4 +- .../concurrent/qfutureinterface.cpp | 0 .../concurrent/qfutureinterface.h | 4 +- .../concurrent/qfutureinterface_p.h | 0 .../concurrent/qfuturesynchronizer.cpp | 0 .../concurrent/qfuturesynchronizer.h | 2 +- .../concurrent/qfuturewatcher.cpp | 0 src/{corelib => }/concurrent/qfuturewatcher.h | 2 +- .../concurrent/qfuturewatcher_p.h | 0 .../concurrent/qtconcurrentcompilertest.h | 0 .../concurrent/qtconcurrentexception.cpp | 0 .../concurrent/qtconcurrentexception.h | 0 .../concurrent/qtconcurrentfilter.cpp | 0 .../concurrent/qtconcurrentfilter.h | 4 +- .../concurrent/qtconcurrentfilterkernel.h | 6 +- .../concurrent/qtconcurrentfunctionwrappers.h | 0 .../concurrent/qtconcurrentiteratekernel.cpp | 0 .../concurrent/qtconcurrentiteratekernel.h | 4 +- .../concurrent/qtconcurrentmap.cpp | 0 .../concurrent/qtconcurrentmap.h | 6 +- .../concurrent/qtconcurrentmapkernel.h | 4 +- .../concurrent/qtconcurrentmedian.h | 0 .../concurrent/qtconcurrentreducekernel.h | 0 .../concurrent/qtconcurrentresultstore.cpp | 0 .../concurrent/qtconcurrentresultstore.h | 0 .../concurrent/qtconcurrentrun.cpp | 0 .../concurrent/qtconcurrentrun.h | 4 +- .../concurrent/qtconcurrentrunbase.h | 2 +- .../qtconcurrentstoredfunctioncall.h | 2 +- .../concurrent/qtconcurrentthreadengine.cpp | 0 .../concurrent/qtconcurrentthreadengine.h | 4 +- src/corelib/concurrent/concurrent.pri | 42 ---------- src/corelib/corelib.pro | 1 - src/corelib/global/qglobal.h | 8 ++ src/corelib/kernel/qcoreapplication.cpp | 2 - .../{concurrent => thread}/qrunnable.cpp | 0 .../{concurrent => thread}/qrunnable.h | 0 .../{concurrent => thread}/qthreadpool.cpp | 0 .../{concurrent => thread}/qthreadpool.h | 0 .../{concurrent => thread}/qthreadpool_p.h | 2 +- src/corelib/thread/thread.pri | 7 +- src/modules/qt_concurrent.pri | 15 ++++ src/src.pro | 4 + sync.profile | 4 + tests/auto/auto.pro | 4 + .../{corelib => }/concurrent/concurrent.pro | 3 +- .../concurrent/qfuture/.gitignore | 0 .../concurrent/qfuture/qfuture.pro | 2 +- .../concurrent/qfuture/tst_qfuture.cpp | 0 .../qfuturesynchronizer.pro | 2 +- .../tst_qfuturesynchronizer.cpp | 4 +- .../concurrent/qfuturewatcher/.gitignore | 0 .../qfuturewatcher/qfuturewatcher.pro | 2 +- .../qfuturewatcher/tst_qfuturewatcher.cpp | 5 +- .../concurrent/qtconcurrentfilter/.gitignore | 0 .../qtconcurrentfilter/qtconcurrentfilter.pro | 2 +- .../tst_qtconcurrentfilter.cpp | 0 .../qtconcurrentiteratekernel/.gitignore | 0 .../qtconcurrentiteratekernel.pro | 2 +- .../tst_qtconcurrentiteratekernel.cpp | 0 .../concurrent/qtconcurrentmap/.gitignore | 0 .../concurrent/qtconcurrentmap/functions.h | 0 .../qtconcurrentmap/qtconcurrentmap.pro | 2 +- .../qtconcurrentmap/tst_qtconcurrentmap.cpp | 0 .../qtconcurrentresultstore.pro | 2 +- .../tst_qtconcurrentresultstore.cpp | 0 .../concurrent/qtconcurrentrun/.gitignore | 0 .../qtconcurrentrun/qtconcurrentrun.pro | 2 +- .../qtconcurrentrun/tst_qtconcurrentrun.cpp | 0 .../qtconcurrentthreadengine/.gitignore | 0 .../qtconcurrentthreadengine.pro | 2 +- .../tst_qtconcurrentthreadengine.cpp | 0 .../codecs/qtextcodec/tst_qtextcodec.cpp | 82 ++++++++++++------- tests/auto/corelib/corelib.pro | 2 - .../qthreadpool/.gitignore | 0 .../qthreadpool/qthreadpool.pro | 0 .../qthreadpool/tst_qthreadpool.cpp | 0 tests/auto/corelib/thread/thread.pro | 1 + 91 files changed, 204 insertions(+), 124 deletions(-) create mode 100644 src/concurrent/concurrent.pro rename src/{corelib => }/concurrent/qfuture.cpp (100%) rename src/{corelib => }/concurrent/qfuture.h (98%) rename src/{corelib => }/concurrent/qfutureinterface.cpp (100%) rename src/{corelib => }/concurrent/qfutureinterface.h (98%) rename src/{corelib => }/concurrent/qfutureinterface_p.h (100%) rename src/{corelib => }/concurrent/qfuturesynchronizer.cpp (100%) rename src/{corelib => }/concurrent/qfuturesynchronizer.h (98%) rename src/{corelib => }/concurrent/qfuturewatcher.cpp (100%) rename src/{corelib => }/concurrent/qfuturewatcher.h (99%) rename src/{corelib => }/concurrent/qfuturewatcher_p.h (100%) rename src/{corelib => }/concurrent/qtconcurrentcompilertest.h (100%) rename src/{corelib => }/concurrent/qtconcurrentexception.cpp (100%) rename src/{corelib => }/concurrent/qtconcurrentexception.h (100%) rename src/{corelib => }/concurrent/qtconcurrentfilter.cpp (100%) rename src/{corelib => }/concurrent/qtconcurrentfilter.h (99%) rename src/{corelib => }/concurrent/qtconcurrentfilterkernel.h (98%) rename src/{corelib => }/concurrent/qtconcurrentfunctionwrappers.h (100%) rename src/{corelib => }/concurrent/qtconcurrentiteratekernel.cpp (100%) rename src/{corelib => }/concurrent/qtconcurrentiteratekernel.h (99%) rename src/{corelib => }/concurrent/qtconcurrentmap.cpp (100%) rename src/{corelib => }/concurrent/qtconcurrentmap.h (98%) rename src/{corelib => }/concurrent/qtconcurrentmapkernel.h (98%) rename src/{corelib => }/concurrent/qtconcurrentmedian.h (100%) rename src/{corelib => }/concurrent/qtconcurrentreducekernel.h (100%) rename src/{corelib => }/concurrent/qtconcurrentresultstore.cpp (100%) rename src/{corelib => }/concurrent/qtconcurrentresultstore.h (100%) rename src/{corelib => }/concurrent/qtconcurrentrun.cpp (100%) rename src/{corelib => }/concurrent/qtconcurrentrun.h (99%) rename src/{corelib => }/concurrent/qtconcurrentrunbase.h (99%) rename src/{corelib => }/concurrent/qtconcurrentstoredfunctioncall.h (99%) rename src/{corelib => }/concurrent/qtconcurrentthreadengine.cpp (100%) rename src/{corelib => }/concurrent/qtconcurrentthreadengine.h (99%) delete mode 100644 src/corelib/concurrent/concurrent.pri rename src/corelib/{concurrent => thread}/qrunnable.cpp (100%) rename src/corelib/{concurrent => thread}/qrunnable.h (100%) rename src/corelib/{concurrent => thread}/qthreadpool.cpp (100%) rename src/corelib/{concurrent => thread}/qthreadpool.h (100%) rename src/corelib/{concurrent => thread}/qthreadpool_p.h (98%) create mode 100644 src/modules/qt_concurrent.pri rename tests/auto/{corelib => }/concurrent/concurrent.pro (82%) rename tests/auto/{corelib => }/concurrent/qfuture/.gitignore (100%) rename tests/auto/{corelib => }/concurrent/qfuture/qfuture.pro (72%) rename tests/auto/{corelib => }/concurrent/qfuture/tst_qfuture.cpp (100%) rename tests/auto/{corelib => }/concurrent/qfuturesynchronizer/qfuturesynchronizer.pro (78%) rename tests/auto/{corelib => }/concurrent/qfuturesynchronizer/tst_qfuturesynchronizer.cpp (98%) rename tests/auto/{corelib => }/concurrent/qfuturewatcher/.gitignore (100%) rename tests/auto/{corelib => }/concurrent/qfuturewatcher/qfuturewatcher.pro (68%) rename tests/auto/{corelib => }/concurrent/qfuturewatcher/tst_qfuturewatcher.cpp (99%) rename tests/auto/{corelib => }/concurrent/qtconcurrentfilter/.gitignore (100%) rename tests/auto/{corelib => }/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro (86%) rename tests/auto/{corelib => }/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp (100%) rename tests/auto/{corelib => }/concurrent/qtconcurrentiteratekernel/.gitignore (100%) rename tests/auto/{corelib => }/concurrent/qtconcurrentiteratekernel/qtconcurrentiteratekernel.pro (80%) rename tests/auto/{corelib => }/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp (100%) rename tests/auto/{corelib => }/concurrent/qtconcurrentmap/.gitignore (100%) rename tests/auto/{corelib => }/concurrent/qtconcurrentmap/functions.h (100%) rename tests/auto/{corelib => }/concurrent/qtconcurrentmap/qtconcurrentmap.pro (81%) rename tests/auto/{corelib => }/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp (100%) rename tests/auto/{corelib => }/concurrent/qtconcurrentresultstore/qtconcurrentresultstore.pro (79%) rename tests/auto/{corelib => }/concurrent/qtconcurrentresultstore/tst_qtconcurrentresultstore.cpp (100%) rename tests/auto/{corelib => }/concurrent/qtconcurrentrun/.gitignore (100%) rename tests/auto/{corelib => }/concurrent/qtconcurrentrun/qtconcurrentrun.pro (76%) rename tests/auto/{corelib => }/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp (100%) rename tests/auto/{corelib => }/concurrent/qtconcurrentthreadengine/.gitignore (100%) rename tests/auto/{corelib => }/concurrent/qtconcurrentthreadengine/qtconcurrentthreadengine.pro (79%) rename tests/auto/{corelib => }/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp (100%) rename tests/auto/corelib/{concurrent => thread}/qthreadpool/.gitignore (100%) rename tests/auto/corelib/{concurrent => thread}/qthreadpool/qthreadpool.pro (100%) rename tests/auto/corelib/{concurrent => thread}/qthreadpool/tst_qthreadpool.cpp (100%) diff --git a/bin/fixqt4headers.pl b/bin/fixqt4headers.pl index 3516168dc2d..2c92f727b7d 100755 --- a/bin/fixqt4headers.pl +++ b/bin/fixqt4headers.pl @@ -141,6 +141,7 @@ sub findQtHeaders die "This script requires the QTDIR environment variable pointing to Qt 5\n" unless $qtdir; findQtHeaders('QtCore', $qtdir); +findQtHeaders('QtConcurrent', $qtdir); findQtHeaders('QtWidgets', $qtdir); findQtHeaders('QtPrintSupport', $qtdir); diff --git a/examples/qtconcurrent/imagescaling/imagescaling.h b/examples/qtconcurrent/imagescaling/imagescaling.h index 204a297ef3e..1f68a3838ae 100644 --- a/examples/qtconcurrent/imagescaling/imagescaling.h +++ b/examples/qtconcurrent/imagescaling/imagescaling.h @@ -41,6 +41,7 @@ #define IMAGESCALING_H #include +#include #ifndef QT_NO_CONCURRENT diff --git a/examples/qtconcurrent/imagescaling/imagescaling.pro b/examples/qtconcurrent/imagescaling/imagescaling.pro index 2ec5abddf68..b268aa75f2e 100644 --- a/examples/qtconcurrent/imagescaling/imagescaling.pro +++ b/examples/qtconcurrent/imagescaling/imagescaling.pro @@ -1,6 +1,7 @@ TEMPLATE = app DEPENDPATH += . INCLUDEPATH += . +QT += concurrent # Input SOURCES += main.cpp imagescaling.cpp diff --git a/examples/qtconcurrent/imagescaling/main.cpp b/examples/qtconcurrent/imagescaling/main.cpp index f7a359c2afc..9fef7d3100b 100644 --- a/examples/qtconcurrent/imagescaling/main.cpp +++ b/examples/qtconcurrent/imagescaling/main.cpp @@ -38,6 +38,7 @@ ** ****************************************************************************/ #include +#include #ifndef QT_NO_CONCURRENT diff --git a/examples/qtconcurrent/map/map.pro b/examples/qtconcurrent/map/map.pro index 978eae44b91..72f770755f3 100644 --- a/examples/qtconcurrent/map/map.pro +++ b/examples/qtconcurrent/map/map.pro @@ -2,6 +2,7 @@ TEMPLATE = app TARGET = mapdemo DEPENDPATH += . INCLUDEPATH += . +QT += concurrent widgets # Input SOURCES += main.cpp @@ -13,6 +14,4 @@ sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/map INSTALLS += target sources -QT += widgets - simulator: warning(This example does not work on Simulator platform) diff --git a/examples/qtconcurrent/progressdialog/main.cpp b/examples/qtconcurrent/progressdialog/main.cpp index b26824c1721..87ea4f5486a 100644 --- a/examples/qtconcurrent/progressdialog/main.cpp +++ b/examples/qtconcurrent/progressdialog/main.cpp @@ -39,6 +39,7 @@ ****************************************************************************/ #include +#include #ifndef QT_NO_CONCURRENT diff --git a/examples/qtconcurrent/progressdialog/progressdialog.pro b/examples/qtconcurrent/progressdialog/progressdialog.pro index fbc239d199e..75a3aba0aed 100644 --- a/examples/qtconcurrent/progressdialog/progressdialog.pro +++ b/examples/qtconcurrent/progressdialog/progressdialog.pro @@ -12,6 +12,6 @@ sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/progressdialog INSTALLS += target sources -QT += widgets +QT += concurrent widgets simulator: warning(This example does not work on Simulator platform) diff --git a/examples/qtconcurrent/runfunction/runfunction.pro b/examples/qtconcurrent/runfunction/runfunction.pro index d41b88e2b01..f047577c9f2 100644 --- a/examples/qtconcurrent/runfunction/runfunction.pro +++ b/examples/qtconcurrent/runfunction/runfunction.pro @@ -12,6 +12,6 @@ sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/runfunction INSTALLS += target sources -QT += widgets +QT += concurrent widgets simulator: warning(This example does not work on Simulator platform) diff --git a/examples/qtconcurrent/wordcount/wordcount.pro b/examples/qtconcurrent/wordcount/wordcount.pro index ee4887c0f13..3bddf1a8627 100644 --- a/examples/qtconcurrent/wordcount/wordcount.pro +++ b/examples/qtconcurrent/wordcount/wordcount.pro @@ -12,6 +12,6 @@ sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/wordcount INSTALLS += target sources -QT += widgets +QT += concurrent widgets simulator: warning(This example does not work on Simulator platform) diff --git a/examples/tutorials/threads/helloconcurrent/helloconcurrent.cpp b/examples/tutorials/threads/helloconcurrent/helloconcurrent.cpp index fb8f55db94d..02aed98c1dc 100644 --- a/examples/tutorials/threads/helloconcurrent/helloconcurrent.cpp +++ b/examples/tutorials/threads/helloconcurrent/helloconcurrent.cpp @@ -39,6 +39,8 @@ ****************************************************************************/ #include +#include + /* says hello from main thread and secondary thread using QtConcurrent */ diff --git a/examples/tutorials/threads/helloconcurrent/helloconcurrent.pro b/examples/tutorials/threads/helloconcurrent/helloconcurrent.pro index fb3cd0b3947..19416667556 100644 --- a/examples/tutorials/threads/helloconcurrent/helloconcurrent.pro +++ b/examples/tutorials/threads/helloconcurrent/helloconcurrent.pro @@ -1,4 +1,5 @@ QT -= gui +QT += concurrent CONFIG += console CONFIG -= app_bundle diff --git a/src/concurrent/concurrent.pro b/src/concurrent/concurrent.pro new file mode 100644 index 00000000000..a9482af0572 --- /dev/null +++ b/src/concurrent/concurrent.pro @@ -0,0 +1,59 @@ +TARGET = QtConcurrent +QPRO_PWD = $$PWD +QT = core-private + +CONFIG += module +MODULE_PRI = ../modules/qt_concurrent.pri + +DEFINES += QT_BUILD_CONCURRENT_LIB QT_NO_USING_NAMESPACE +win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000 + +unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore + +load(qt_module_config) + +HEADERS += $$QT_SOURCE_TREE/src/xml/qtconcurrentversion.h + +PRECOMPILED_HEADER = ../corelib/global/qt_pch.h + +SOURCES += \ + qfuture.cpp \ + qfutureinterface.cpp \ + qfuturesynchronizer.cpp \ + qfuturewatcher.cpp \ + qtconcurrentfilter.cpp \ + qtconcurrentmap.cpp \ + qtconcurrentresultstore.cpp \ + qtconcurrentthreadengine.cpp \ + qtconcurrentiteratekernel.cpp \ + qtconcurrentexception.cpp + +HEADERS += \ + qfuture.h \ + qfutureinterface.h \ + qfuturesynchronizer.h \ + qfuturewatcher.h \ + qtconcurrentcompilertest.h \ + qtconcurrentexception.h \ + qtconcurrentfilter.h \ + qtconcurrentfilterkernel.h \ + qtconcurrentfunctionwrappers.h \ + qtconcurrentiteratekernel.h \ + qtconcurrentmap.h \ + qtconcurrentmapkernel.h \ + qtconcurrentmedian.h \ + qtconcurrentreducekernel.h \ + qtconcurrentresultstore.h \ + qtconcurrentrun.h \ + qtconcurrentrunbase.h \ + qtconcurrentstoredfunctioncall.h \ + qtconcurrentthreadengine.h + +# private headers +HEADERS += \ + qfutureinterface_p.h \ + qfuturewatcher_p.h + +contains(QT_CONFIG, clock-gettime) { + linux-*|hpux-*|solaris-*:LIBS *= -lrt +} diff --git a/src/corelib/concurrent/qfuture.cpp b/src/concurrent/qfuture.cpp similarity index 100% rename from src/corelib/concurrent/qfuture.cpp rename to src/concurrent/qfuture.cpp diff --git a/src/corelib/concurrent/qfuture.h b/src/concurrent/qfuture.h similarity index 98% rename from src/corelib/concurrent/qfuture.h rename to src/concurrent/qfuture.h index a22168aaba6..6e99a6068e2 100644 --- a/src/corelib/concurrent/qfuture.h +++ b/src/concurrent/qfuture.h @@ -46,9 +46,9 @@ #ifndef QT_NO_QFUTURE -#include +#include #include -#include +#include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/corelib/concurrent/qfutureinterface.cpp b/src/concurrent/qfutureinterface.cpp similarity index 100% rename from src/corelib/concurrent/qfutureinterface.cpp rename to src/concurrent/qfutureinterface.cpp diff --git a/src/corelib/concurrent/qfutureinterface.h b/src/concurrent/qfutureinterface.h similarity index 98% rename from src/corelib/concurrent/qfutureinterface.h rename to src/concurrent/qfutureinterface.h index 85272bc565b..f64623ae587 100644 --- a/src/corelib/concurrent/qfutureinterface.h +++ b/src/concurrent/qfutureinterface.h @@ -48,8 +48,8 @@ #ifndef QT_NO_QFUTURE #include -#include -#include +#include +#include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/corelib/concurrent/qfutureinterface_p.h b/src/concurrent/qfutureinterface_p.h similarity index 100% rename from src/corelib/concurrent/qfutureinterface_p.h rename to src/concurrent/qfutureinterface_p.h diff --git a/src/corelib/concurrent/qfuturesynchronizer.cpp b/src/concurrent/qfuturesynchronizer.cpp similarity index 100% rename from src/corelib/concurrent/qfuturesynchronizer.cpp rename to src/concurrent/qfuturesynchronizer.cpp diff --git a/src/corelib/concurrent/qfuturesynchronizer.h b/src/concurrent/qfuturesynchronizer.h similarity index 98% rename from src/corelib/concurrent/qfuturesynchronizer.h rename to src/concurrent/qfuturesynchronizer.h index 1661cae13c6..8b7e710ea93 100644 --- a/src/corelib/concurrent/qfuturesynchronizer.h +++ b/src/concurrent/qfuturesynchronizer.h @@ -42,7 +42,7 @@ #ifndef QFUTRUESYNCHRONIZER_H #define QFUTRUESYNCHRONIZER_H -#include +#include #ifndef QT_NO_CONCURRENT diff --git a/src/corelib/concurrent/qfuturewatcher.cpp b/src/concurrent/qfuturewatcher.cpp similarity index 100% rename from src/corelib/concurrent/qfuturewatcher.cpp rename to src/concurrent/qfuturewatcher.cpp diff --git a/src/corelib/concurrent/qfuturewatcher.h b/src/concurrent/qfuturewatcher.h similarity index 99% rename from src/corelib/concurrent/qfuturewatcher.h rename to src/concurrent/qfuturewatcher.h index 6029331ed1a..0e94863d129 100644 --- a/src/corelib/concurrent/qfuturewatcher.h +++ b/src/concurrent/qfuturewatcher.h @@ -42,7 +42,7 @@ #ifndef QFUTUREWATCHER_H #define QFUTUREWATCHER_H -#include +#include #ifndef QT_NO_QFUTURE diff --git a/src/corelib/concurrent/qfuturewatcher_p.h b/src/concurrent/qfuturewatcher_p.h similarity index 100% rename from src/corelib/concurrent/qfuturewatcher_p.h rename to src/concurrent/qfuturewatcher_p.h diff --git a/src/corelib/concurrent/qtconcurrentcompilertest.h b/src/concurrent/qtconcurrentcompilertest.h similarity index 100% rename from src/corelib/concurrent/qtconcurrentcompilertest.h rename to src/concurrent/qtconcurrentcompilertest.h diff --git a/src/corelib/concurrent/qtconcurrentexception.cpp b/src/concurrent/qtconcurrentexception.cpp similarity index 100% rename from src/corelib/concurrent/qtconcurrentexception.cpp rename to src/concurrent/qtconcurrentexception.cpp diff --git a/src/corelib/concurrent/qtconcurrentexception.h b/src/concurrent/qtconcurrentexception.h similarity index 100% rename from src/corelib/concurrent/qtconcurrentexception.h rename to src/concurrent/qtconcurrentexception.h diff --git a/src/corelib/concurrent/qtconcurrentfilter.cpp b/src/concurrent/qtconcurrentfilter.cpp similarity index 100% rename from src/corelib/concurrent/qtconcurrentfilter.cpp rename to src/concurrent/qtconcurrentfilter.cpp diff --git a/src/corelib/concurrent/qtconcurrentfilter.h b/src/concurrent/qtconcurrentfilter.h similarity index 99% rename from src/corelib/concurrent/qtconcurrentfilter.h rename to src/concurrent/qtconcurrentfilter.h index f5c38654d39..1de8d230b1d 100644 --- a/src/corelib/concurrent/qtconcurrentfilter.h +++ b/src/concurrent/qtconcurrentfilter.h @@ -46,8 +46,8 @@ #ifndef QT_NO_CONCURRENT -#include -#include +#include +#include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/corelib/concurrent/qtconcurrentfilterkernel.h b/src/concurrent/qtconcurrentfilterkernel.h similarity index 98% rename from src/corelib/concurrent/qtconcurrentfilterkernel.h rename to src/concurrent/qtconcurrentfilterkernel.h index ea0e5fcf5d2..71112cb5a34 100644 --- a/src/corelib/concurrent/qtconcurrentfilterkernel.h +++ b/src/concurrent/qtconcurrentfilterkernel.h @@ -46,9 +46,9 @@ #ifndef QT_NO_CONCURRENT -#include -#include -#include +#include +#include +#include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/corelib/concurrent/qtconcurrentfunctionwrappers.h b/src/concurrent/qtconcurrentfunctionwrappers.h similarity index 100% rename from src/corelib/concurrent/qtconcurrentfunctionwrappers.h rename to src/concurrent/qtconcurrentfunctionwrappers.h diff --git a/src/corelib/concurrent/qtconcurrentiteratekernel.cpp b/src/concurrent/qtconcurrentiteratekernel.cpp similarity index 100% rename from src/corelib/concurrent/qtconcurrentiteratekernel.cpp rename to src/concurrent/qtconcurrentiteratekernel.cpp diff --git a/src/corelib/concurrent/qtconcurrentiteratekernel.h b/src/concurrent/qtconcurrentiteratekernel.h similarity index 99% rename from src/corelib/concurrent/qtconcurrentiteratekernel.h rename to src/concurrent/qtconcurrentiteratekernel.h index 527bd85a228..a28bc31a645 100644 --- a/src/corelib/concurrent/qtconcurrentiteratekernel.h +++ b/src/concurrent/qtconcurrentiteratekernel.h @@ -47,8 +47,8 @@ #ifndef QT_NO_CONCURRENT #include -#include -#include +#include +#include #ifndef QT_NO_STL # include diff --git a/src/corelib/concurrent/qtconcurrentmap.cpp b/src/concurrent/qtconcurrentmap.cpp similarity index 100% rename from src/corelib/concurrent/qtconcurrentmap.cpp rename to src/concurrent/qtconcurrentmap.cpp diff --git a/src/corelib/concurrent/qtconcurrentmap.h b/src/concurrent/qtconcurrentmap.h similarity index 98% rename from src/corelib/concurrent/qtconcurrentmap.h rename to src/concurrent/qtconcurrentmap.h index ef66cc1a1af..8a5557183d9 100644 --- a/src/corelib/concurrent/qtconcurrentmap.h +++ b/src/concurrent/qtconcurrentmap.h @@ -46,9 +46,9 @@ #ifndef QT_NO_CONCURRENT -#include -#include -#include +#include +#include +#include #include QT_BEGIN_HEADER diff --git a/src/corelib/concurrent/qtconcurrentmapkernel.h b/src/concurrent/qtconcurrentmapkernel.h similarity index 98% rename from src/corelib/concurrent/qtconcurrentmapkernel.h rename to src/concurrent/qtconcurrentmapkernel.h index 47cf143fffa..ceeaa6e3b35 100644 --- a/src/corelib/concurrent/qtconcurrentmapkernel.h +++ b/src/concurrent/qtconcurrentmapkernel.h @@ -46,8 +46,8 @@ #ifndef QT_NO_CONCURRENT -#include -#include +#include +#include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/corelib/concurrent/qtconcurrentmedian.h b/src/concurrent/qtconcurrentmedian.h similarity index 100% rename from src/corelib/concurrent/qtconcurrentmedian.h rename to src/concurrent/qtconcurrentmedian.h diff --git a/src/corelib/concurrent/qtconcurrentreducekernel.h b/src/concurrent/qtconcurrentreducekernel.h similarity index 100% rename from src/corelib/concurrent/qtconcurrentreducekernel.h rename to src/concurrent/qtconcurrentreducekernel.h diff --git a/src/corelib/concurrent/qtconcurrentresultstore.cpp b/src/concurrent/qtconcurrentresultstore.cpp similarity index 100% rename from src/corelib/concurrent/qtconcurrentresultstore.cpp rename to src/concurrent/qtconcurrentresultstore.cpp diff --git a/src/corelib/concurrent/qtconcurrentresultstore.h b/src/concurrent/qtconcurrentresultstore.h similarity index 100% rename from src/corelib/concurrent/qtconcurrentresultstore.h rename to src/concurrent/qtconcurrentresultstore.h diff --git a/src/corelib/concurrent/qtconcurrentrun.cpp b/src/concurrent/qtconcurrentrun.cpp similarity index 100% rename from src/corelib/concurrent/qtconcurrentrun.cpp rename to src/concurrent/qtconcurrentrun.cpp diff --git a/src/corelib/concurrent/qtconcurrentrun.h b/src/concurrent/qtconcurrentrun.h similarity index 99% rename from src/corelib/concurrent/qtconcurrentrun.h rename to src/concurrent/qtconcurrentrun.h index fc4bd01eaa4..d7285388da6 100644 --- a/src/corelib/concurrent/qtconcurrentrun.h +++ b/src/concurrent/qtconcurrentrun.h @@ -47,8 +47,8 @@ #ifndef QT_NO_CONCURRENT -#include -#include +#include +#include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/corelib/concurrent/qtconcurrentrunbase.h b/src/concurrent/qtconcurrentrunbase.h similarity index 99% rename from src/corelib/concurrent/qtconcurrentrunbase.h rename to src/concurrent/qtconcurrentrunbase.h index 99ca0a9699b..2105437edeb 100644 --- a/src/corelib/concurrent/qtconcurrentrunbase.h +++ b/src/concurrent/qtconcurrentrunbase.h @@ -46,7 +46,7 @@ #ifndef QT_NO_CONCURRENT -#include +#include #include #include diff --git a/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h b/src/concurrent/qtconcurrentstoredfunctioncall.h similarity index 99% rename from src/corelib/concurrent/qtconcurrentstoredfunctioncall.h rename to src/concurrent/qtconcurrentstoredfunctioncall.h index cf426a42037..c311a72427c 100644 --- a/src/corelib/concurrent/qtconcurrentstoredfunctioncall.h +++ b/src/concurrent/qtconcurrentstoredfunctioncall.h @@ -46,7 +46,7 @@ #include #ifndef QT_NO_CONCURRENT -#include +#include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/corelib/concurrent/qtconcurrentthreadengine.cpp b/src/concurrent/qtconcurrentthreadengine.cpp similarity index 100% rename from src/corelib/concurrent/qtconcurrentthreadengine.cpp rename to src/concurrent/qtconcurrentthreadengine.cpp diff --git a/src/corelib/concurrent/qtconcurrentthreadengine.h b/src/concurrent/qtconcurrentthreadengine.h similarity index 99% rename from src/corelib/concurrent/qtconcurrentthreadengine.h rename to src/concurrent/qtconcurrentthreadengine.h index e9c144a3c5a..20e86f59b6d 100644 --- a/src/corelib/concurrent/qtconcurrentthreadengine.h +++ b/src/concurrent/qtconcurrentthreadengine.h @@ -47,9 +47,9 @@ #ifndef QT_NO_CONCURRENT #include -#include +#include #include -#include +#include #include #include #include diff --git a/src/corelib/concurrent/concurrent.pri b/src/corelib/concurrent/concurrent.pri deleted file mode 100644 index 940297139c8..00000000000 --- a/src/corelib/concurrent/concurrent.pri +++ /dev/null @@ -1,42 +0,0 @@ -SOURCES += \ - concurrent/qfuture.cpp \ - concurrent/qfutureinterface.cpp \ - concurrent/qfuturesynchronizer.cpp \ - concurrent/qfuturewatcher.cpp \ - concurrent/qrunnable.cpp \ - concurrent/qtconcurrentfilter.cpp \ - concurrent/qtconcurrentmap.cpp \ - concurrent/qtconcurrentresultstore.cpp \ - concurrent/qtconcurrentthreadengine.cpp \ - concurrent/qtconcurrentiteratekernel.cpp \ - concurrent/qtconcurrentexception.cpp \ - concurrent/qthreadpool.cpp - -HEADERS += \ - concurrent/qfuture.h \ - concurrent/qfutureinterface.h \ - concurrent/qfuturesynchronizer.h \ - concurrent/qfuturewatcher.h \ - concurrent/qrunnable.h \ - concurrent/qtconcurrentcompilertest.h \ - concurrent/qtconcurrentexception.h \ - concurrent/qtconcurrentfilter.h \ - concurrent/qtconcurrentfilterkernel.h \ - concurrent/qtconcurrentfunctionwrappers.h \ - concurrent/qtconcurrentiteratekernel.h \ - concurrent/qtconcurrentmap.h \ - concurrent/qtconcurrentmapkernel.h \ - concurrent/qtconcurrentmedian.h \ - concurrent/qtconcurrentreducekernel.h \ - concurrent/qtconcurrentresultstore.h \ - concurrent/qtconcurrentrun.h \ - concurrent/qtconcurrentrunbase.h \ - concurrent/qtconcurrentstoredfunctioncall.h \ - concurrent/qtconcurrentthreadengine.h \ - concurrent/qthreadpool.h - -# private headers -HEADERS += \ - concurrent/qfutureinterface_p.h \ - concurrent/qfuturewatcher_p.h \ - concurrent/qthreadpool_p.h diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index de2b1006cf3..c8c9b9b8e6f 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -18,7 +18,6 @@ HEADERS += $$QT_SOURCE_TREE/src/corelib/qtcoreversion.h include(animation/animation.pri) include(arch/arch.pri) -include(concurrent/concurrent.pri) include(global/global.pri) include(thread/thread.pri) include(tools/tools.pri) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 681cd55bb08..c92336f95c8 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1326,6 +1326,11 @@ class QDataStream; # define Q_DBUS_EXPORT Q_DECL_IMPORT # endif # define Q_TEMPLATEDLL +# if defined(QT_BUILD_CONCURRENT_LIB) +# define Q_CONCURRENT_EXPORT Q_DECL_EXPORT +# else +# define Q_CONCURRENT_EXPORT Q_DECL_IMPORT +# endif # elif defined(QT_DLL) /* use a Qt DLL library */ # define Q_CORE_EXPORT Q_DECL_IMPORT # define Q_GUI_EXPORT Q_DECL_IMPORT @@ -1347,6 +1352,7 @@ class QDataStream; # define Q_SCRIPTTOOLS_EXPORT Q_DECL_IMPORT # define Q_COMPAT_EXPORT Q_DECL_IMPORT # define Q_DBUS_EXPORT Q_DECL_IMPORT +# define Q_CONCURRENT_EXPORT Q_DECL_IMPORT # define Q_TEMPLATEDLL # endif # define Q_NO_DECLARED_NOT_DEFINED @@ -1380,6 +1386,7 @@ class QDataStream; # define Q_SCRIPTTOOLS_EXPORT Q_DECL_EXPORT # define Q_COMPAT_EXPORT Q_DECL_EXPORT # define Q_DBUS_EXPORT Q_DECL_EXPORT +# define Q_CONCURRENT_EXPORT Q_DECL_EXPORT # else # define Q_CORE_EXPORT # define Q_GUI_EXPORT @@ -1400,6 +1407,7 @@ class QDataStream; # define Q_SCRIPTTOOLS_EXPORT # define Q_COMPAT_EXPORT # define Q_DBUS_EXPORT +# define Q_CONCURRENT_EXPORT # endif #endif diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index a248e18a6a3..cf3ae1b7c5f 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -593,7 +593,6 @@ QCoreApplication::~QCoreApplication() QCoreApplicationPrivate::is_app_running = false; #if !defined(QT_NO_THREAD) -#if !defined(QT_NO_CONCURRENT) // Synchronize and stop the global thread pool threads. QThreadPool *globalThreadPool = 0; QT_TRY { @@ -603,7 +602,6 @@ QCoreApplication::~QCoreApplication() } if (globalThreadPool) globalThreadPool->waitForDone(); -#endif QThread::cleanup(); #endif diff --git a/src/corelib/concurrent/qrunnable.cpp b/src/corelib/thread/qrunnable.cpp similarity index 100% rename from src/corelib/concurrent/qrunnable.cpp rename to src/corelib/thread/qrunnable.cpp diff --git a/src/corelib/concurrent/qrunnable.h b/src/corelib/thread/qrunnable.h similarity index 100% rename from src/corelib/concurrent/qrunnable.h rename to src/corelib/thread/qrunnable.h diff --git a/src/corelib/concurrent/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp similarity index 100% rename from src/corelib/concurrent/qthreadpool.cpp rename to src/corelib/thread/qthreadpool.cpp diff --git a/src/corelib/concurrent/qthreadpool.h b/src/corelib/thread/qthreadpool.h similarity index 100% rename from src/corelib/concurrent/qthreadpool.h rename to src/corelib/thread/qthreadpool.h diff --git a/src/corelib/concurrent/qthreadpool_p.h b/src/corelib/thread/qthreadpool_p.h similarity index 98% rename from src/corelib/concurrent/qthreadpool_p.h rename to src/corelib/thread/qthreadpool_p.h index f4c67b81a77..9a7c09695f0 100644 --- a/src/corelib/concurrent/qthreadpool_p.h +++ b/src/corelib/thread/qthreadpool_p.h @@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE class QThreadPoolThread; -class QThreadPoolPrivate : public QObjectPrivate +class Q_CORE_EXPORT QThreadPoolPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QThreadPool) friend class QThreadPoolThread; diff --git a/src/corelib/thread/thread.pri b/src/corelib/thread/thread.pri index ea6f0eb91e4..1eefa60d500 100644 --- a/src/corelib/thread/thread.pri +++ b/src/corelib/thread/thread.pri @@ -2,9 +2,11 @@ # public headers HEADERS += thread/qmutex.h \ + thread/qrunnable.h \ thread/qreadwritelock.h \ thread/qsemaphore.h \ thread/qthread.h \ + thread/qthreadpool.h \ thread/qthreadstorage.h \ thread/qwaitcondition.h \ thread/qatomic.h \ @@ -17,14 +19,17 @@ HEADERS += thread/qmutex_p.h \ thread/qmutexpool_p.h \ thread/qorderedmutexlocker_p.h \ thread/qreadwritelock_p.h \ - thread/qthread_p.h + thread/qthread_p.h \ + thread/qthreadpool_p.h SOURCES += thread/qatomic.cpp \ thread/qmutex.cpp \ thread/qreadwritelock.cpp \ + thread/qrunnable.cpp \ thread/qmutexpool.cpp \ thread/qsemaphore.cpp \ thread/qthread.cpp \ + thread/qthreadpool.cpp \ thread/qthreadstorage.cpp unix:SOURCES += thread/qthread_unix.cpp \ diff --git a/src/modules/qt_concurrent.pri b/src/modules/qt_concurrent.pri new file mode 100644 index 00000000000..eccec12f664 --- /dev/null +++ b/src/modules/qt_concurrent.pri @@ -0,0 +1,15 @@ +QT.concurrent.VERSION = 5.0.0 +QT.concurrent.MAJOR_VERSION = 5 +QT.concurrent.MINOR_VERSION = 0 +QT.concurrent.PATCH_VERSION = 0 + +QT.concurrent.name = QtConcurrent +QT.concurrent.bins = $$QT_MODULE_BIN_BASE +QT.concurrent.includes = $$QT_MODULE_INCLUDE_BASE/QtConcurrent +QT.concurrent.private_includes = $$QT_MODULE_INCLUDE_BASE/QtConcurrent/$$QT.concurrent.VERSION +QT.concurrent.sources = $$QT_MODULE_BASE/src/concurrent +QT.concurrent.libs = $$QT_MODULE_LIB_BASE +QT.concurrent.plugins = $$QT_MODULE_PLUGIN_BASE +QT.concurrent.imports = $$QT_MODULE_IMPORT_BASE +QT.concurrent.depends = core +QT.concurrent.DEFINES = QT_CONCURRENT_LIB diff --git a/src/src.pro b/src/src.pro index 8d750bab767..9ef8bf43628 100644 --- a/src/src.pro +++ b/src/src.pro @@ -8,6 +8,7 @@ SRC_SUBDIRS += src_corelib SRC_SUBDIRS += src_network src_sql src_gui src_xml src_widgets src_printsupport src_testlib src_platformsupport nacl: SRC_SUBDIRS -= src_network src_testlib contains(QT_CONFIG, dbus):SRC_SUBDIRS += src_dbus +contains(QT_CONFIG, concurrent):SRC_SUBDIRS += src_concurrent contains(QT_CONFIG, no-gui): SRC_SUBDIRS -= src_gui @@ -40,6 +41,8 @@ src_testlib.subdir = $$QT_SOURCE_TREE/src/testlib src_testlib.target = sub-testlib src_platformsupport.subdir = $$QT_SOURCE_TREE/src/platformsupport src_platformsupport.target = sub-platformsupport +src_concurrent.subdir = $$QT_SOURCE_TREE/src/concurrent +src_concurrent.target = sub-concurrent #CONFIG += ordered @@ -50,6 +53,7 @@ src_platformsupport.target = sub-platformsupport src_platformsupport.depends = src_corelib src_gui src_network src_widgets.depends = src_corelib src_gui src_tools_uic src_xml.depends = src_corelib + src_concurrent.depends = src_corelib src_dbus.depends = src_corelib src_network.depends = src_corelib src_opengl.depends = src_gui src_widgets diff --git a/sync.profile b/sync.profile index cabc8a3ab54..446f8f40fa2 100644 --- a/sync.profile +++ b/sync.profile @@ -9,6 +9,7 @@ "QtNetwork" => "$basedir/src/network", "QtTest" => "$basedir/src/testlib", "QtDBus" => "$basedir/src/dbus", + "QtConcurrent" => "$basedir/src/concurrent", "QtPlatformSupport" => "$basedir/src/platformsupport", ); %moduleheaders = ( # restrict the module headers to those found in relative path @@ -40,6 +41,7 @@ "qtxmlversion.h" => "QtXmlVersion", "qtwidgetsversion.h" => "QtWidgetsVersion", "qtprintsupportversion.h" => "QtPrintSupportVersion", + "qtconcurrentversion.h" => "QtConcurrentVersion", "qtplatformsupportversion.h" => "QtPlatformSupportVersion", ); %mastercontent = ( @@ -50,6 +52,7 @@ "network" => "#include \n", "opengl" => "#include \n", "xml" => "#include \n", + "concurrent" => "#include \n", ); %modulepris = ( "QtCore" => "$basedir/src/modules/qt_core.pri", @@ -62,6 +65,7 @@ "QtSql" => "$basedir/src/modules/qt_sql.pri", "QtTest" => "$basedir/src/modules/qt_testlib.pri", "QtXml" => "$basedir/src/modules/qt_xml.pri", + "QtConcurrent" => "$basedir/src/modules/qt_concurrent.pri", "QtPlatformSupport" => "$basedir/src/modules/qt_platformsupport.pri", ); %explicitheaders = ( diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 4f81c435534..1796fa2db92 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -10,6 +10,7 @@ SUBDIRS += \ testlib \ tools \ xml \ + concurrent \ other \ widgets \ @@ -21,3 +22,6 @@ cross_compile: SUBDIRS -= tools mac { network.CONFIG += no_check_target } + +!contains(QT_CONFIG, concurrent): SUBDIRS -= concurrent + diff --git a/tests/auto/corelib/concurrent/concurrent.pro b/tests/auto/concurrent/concurrent.pro similarity index 82% rename from tests/auto/corelib/concurrent/concurrent.pro rename to tests/auto/concurrent/concurrent.pro index 6541b0ce42f..15368aef641 100644 --- a/tests/auto/corelib/concurrent/concurrent.pro +++ b/tests/auto/concurrent/concurrent.pro @@ -8,6 +8,5 @@ SUBDIRS=\ qtconcurrentmap \ qtconcurrentresultstore \ qtconcurrentrun \ - qtconcurrentthreadengine \ - qthreadpool + qtconcurrentthreadengine diff --git a/tests/auto/corelib/concurrent/qfuture/.gitignore b/tests/auto/concurrent/qfuture/.gitignore similarity index 100% rename from tests/auto/corelib/concurrent/qfuture/.gitignore rename to tests/auto/concurrent/qfuture/.gitignore diff --git a/tests/auto/corelib/concurrent/qfuture/qfuture.pro b/tests/auto/concurrent/qfuture/qfuture.pro similarity index 72% rename from tests/auto/corelib/concurrent/qfuture/qfuture.pro rename to tests/auto/concurrent/qfuture/qfuture.pro index 517871ab5d2..a4c706129d9 100644 --- a/tests/auto/corelib/concurrent/qfuture/qfuture.pro +++ b/tests/auto/concurrent/qfuture/qfuture.pro @@ -1,5 +1,5 @@ CONFIG += testcase parallel_test TARGET = tst_qfuture -QT = core-private testlib +QT = concurrent-private testlib concurrent SOURCES = tst_qfuture.cpp DEFINES += QT_STRICT_ITERATORS diff --git a/tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp b/tests/auto/concurrent/qfuture/tst_qfuture.cpp similarity index 100% rename from tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp rename to tests/auto/concurrent/qfuture/tst_qfuture.cpp diff --git a/tests/auto/corelib/concurrent/qfuturesynchronizer/qfuturesynchronizer.pro b/tests/auto/concurrent/qfuturesynchronizer/qfuturesynchronizer.pro similarity index 78% rename from tests/auto/corelib/concurrent/qfuturesynchronizer/qfuturesynchronizer.pro rename to tests/auto/concurrent/qfuturesynchronizer/qfuturesynchronizer.pro index b36560b4baf..331a8e3c050 100644 --- a/tests/auto/corelib/concurrent/qfuturesynchronizer/qfuturesynchronizer.pro +++ b/tests/auto/concurrent/qfuturesynchronizer/qfuturesynchronizer.pro @@ -1,4 +1,4 @@ CONFIG += testcase parallel_test TARGET = tst_qfuturesynchronizer -QT = core testlib +QT = core testlib concurrent SOURCES = tst_qfuturesynchronizer.cpp diff --git a/tests/auto/corelib/concurrent/qfuturesynchronizer/tst_qfuturesynchronizer.cpp b/tests/auto/concurrent/qfuturesynchronizer/tst_qfuturesynchronizer.cpp similarity index 98% rename from tests/auto/corelib/concurrent/qfuturesynchronizer/tst_qfuturesynchronizer.cpp rename to tests/auto/concurrent/qfuturesynchronizer/tst_qfuturesynchronizer.cpp index 5bf6d1d1f39..012c90de182 100644 --- a/tests/auto/corelib/concurrent/qfuturesynchronizer/tst_qfuturesynchronizer.cpp +++ b/tests/auto/concurrent/qfuturesynchronizer/tst_qfuturesynchronizer.cpp @@ -41,8 +41,8 @@ #include -#include -#include +#include +#include class tst_QFutureSynchronizer : public QObject { diff --git a/tests/auto/corelib/concurrent/qfuturewatcher/.gitignore b/tests/auto/concurrent/qfuturewatcher/.gitignore similarity index 100% rename from tests/auto/corelib/concurrent/qfuturewatcher/.gitignore rename to tests/auto/concurrent/qfuturewatcher/.gitignore diff --git a/tests/auto/corelib/concurrent/qfuturewatcher/qfuturewatcher.pro b/tests/auto/concurrent/qfuturewatcher/qfuturewatcher.pro similarity index 68% rename from tests/auto/corelib/concurrent/qfuturewatcher/qfuturewatcher.pro rename to tests/auto/concurrent/qfuturewatcher/qfuturewatcher.pro index ae98fed3d90..3b8ebda4a4f 100644 --- a/tests/auto/corelib/concurrent/qfuturewatcher/qfuturewatcher.pro +++ b/tests/auto/concurrent/qfuturewatcher/qfuturewatcher.pro @@ -1,4 +1,4 @@ CONFIG += testcase parallel_test TARGET = tst_qfuturewatcher -QT = core-private testlib +QT = concurrent-private testlib concurrent SOURCES = tst_qfuturewatcher.cpp diff --git a/tests/auto/corelib/concurrent/qfuturewatcher/tst_qfuturewatcher.cpp b/tests/auto/concurrent/qfuturewatcher/tst_qfuturewatcher.cpp similarity index 99% rename from tests/auto/corelib/concurrent/qfuturewatcher/tst_qfuturewatcher.cpp rename to tests/auto/concurrent/qfuturewatcher/tst_qfuturewatcher.cpp index 5a86d97d4e7..fe3eb378d51 100644 --- a/tests/auto/corelib/concurrent/qfuturewatcher/tst_qfuturewatcher.cpp +++ b/tests/auto/concurrent/qfuturewatcher/tst_qfuturewatcher.cpp @@ -42,10 +42,7 @@ #include #include -#include -#include -#include -#include +#include #include using namespace QtConcurrent; diff --git a/tests/auto/corelib/concurrent/qtconcurrentfilter/.gitignore b/tests/auto/concurrent/qtconcurrentfilter/.gitignore similarity index 100% rename from tests/auto/corelib/concurrent/qtconcurrentfilter/.gitignore rename to tests/auto/concurrent/qtconcurrentfilter/.gitignore diff --git a/tests/auto/corelib/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro b/tests/auto/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro similarity index 86% rename from tests/auto/corelib/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro rename to tests/auto/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro index f783455b2e4..eb0c054f6f6 100644 --- a/tests/auto/corelib/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro +++ b/tests/auto/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro @@ -1,6 +1,6 @@ CONFIG += testcase parallel_test TARGET = tst_qtconcurrentfilter -QT = core testlib +QT = core testlib concurrent SOURCES = tst_qtconcurrentfilter.cpp DEFINES += QT_STRICT_ITERATORS diff --git a/tests/auto/corelib/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp b/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp similarity index 100% rename from tests/auto/corelib/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp rename to tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp diff --git a/tests/auto/corelib/concurrent/qtconcurrentiteratekernel/.gitignore b/tests/auto/concurrent/qtconcurrentiteratekernel/.gitignore similarity index 100% rename from tests/auto/corelib/concurrent/qtconcurrentiteratekernel/.gitignore rename to tests/auto/concurrent/qtconcurrentiteratekernel/.gitignore diff --git a/tests/auto/corelib/concurrent/qtconcurrentiteratekernel/qtconcurrentiteratekernel.pro b/tests/auto/concurrent/qtconcurrentiteratekernel/qtconcurrentiteratekernel.pro similarity index 80% rename from tests/auto/corelib/concurrent/qtconcurrentiteratekernel/qtconcurrentiteratekernel.pro rename to tests/auto/concurrent/qtconcurrentiteratekernel/qtconcurrentiteratekernel.pro index e876c86725c..4cfebc0e3d0 100644 --- a/tests/auto/corelib/concurrent/qtconcurrentiteratekernel/qtconcurrentiteratekernel.pro +++ b/tests/auto/concurrent/qtconcurrentiteratekernel/qtconcurrentiteratekernel.pro @@ -1,4 +1,4 @@ CONFIG += testcase parallel_test TARGET = tst_qtconcurrentiteratekernel -QT = core testlib +QT = core testlib concurrent SOURCES = tst_qtconcurrentiteratekernel.cpp diff --git a/tests/auto/corelib/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp b/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp similarity index 100% rename from tests/auto/corelib/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp rename to tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp diff --git a/tests/auto/corelib/concurrent/qtconcurrentmap/.gitignore b/tests/auto/concurrent/qtconcurrentmap/.gitignore similarity index 100% rename from tests/auto/corelib/concurrent/qtconcurrentmap/.gitignore rename to tests/auto/concurrent/qtconcurrentmap/.gitignore diff --git a/tests/auto/corelib/concurrent/qtconcurrentmap/functions.h b/tests/auto/concurrent/qtconcurrentmap/functions.h similarity index 100% rename from tests/auto/corelib/concurrent/qtconcurrentmap/functions.h rename to tests/auto/concurrent/qtconcurrentmap/functions.h diff --git a/tests/auto/corelib/concurrent/qtconcurrentmap/qtconcurrentmap.pro b/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro similarity index 81% rename from tests/auto/corelib/concurrent/qtconcurrentmap/qtconcurrentmap.pro rename to tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro index b4f5cbc565d..199e5ad4d65 100644 --- a/tests/auto/corelib/concurrent/qtconcurrentmap/qtconcurrentmap.pro +++ b/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro @@ -1,5 +1,5 @@ CONFIG += testcase parallel_test TARGET = tst_qtconcurrentmap -QT = core testlib +QT = core testlib concurrent SOURCES = tst_qtconcurrentmap.cpp DEFINES += QT_STRICT_ITERATORS diff --git a/tests/auto/corelib/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp similarity index 100% rename from tests/auto/corelib/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp rename to tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp diff --git a/tests/auto/corelib/concurrent/qtconcurrentresultstore/qtconcurrentresultstore.pro b/tests/auto/concurrent/qtconcurrentresultstore/qtconcurrentresultstore.pro similarity index 79% rename from tests/auto/corelib/concurrent/qtconcurrentresultstore/qtconcurrentresultstore.pro rename to tests/auto/concurrent/qtconcurrentresultstore/qtconcurrentresultstore.pro index e93fc587a73..2c04f750250 100644 --- a/tests/auto/corelib/concurrent/qtconcurrentresultstore/qtconcurrentresultstore.pro +++ b/tests/auto/concurrent/qtconcurrentresultstore/qtconcurrentresultstore.pro @@ -1,5 +1,5 @@ CONFIG += testcase parallel_test TARGET = tst_qtconcurrentresultstore -QT = core-private testlib +QT = core-private testlib concurrent SOURCES = tst_qtconcurrentresultstore.cpp DEFINES += QT_STRICT_ITERATORS diff --git a/tests/auto/corelib/concurrent/qtconcurrentresultstore/tst_qtconcurrentresultstore.cpp b/tests/auto/concurrent/qtconcurrentresultstore/tst_qtconcurrentresultstore.cpp similarity index 100% rename from tests/auto/corelib/concurrent/qtconcurrentresultstore/tst_qtconcurrentresultstore.cpp rename to tests/auto/concurrent/qtconcurrentresultstore/tst_qtconcurrentresultstore.cpp diff --git a/tests/auto/corelib/concurrent/qtconcurrentrun/.gitignore b/tests/auto/concurrent/qtconcurrentrun/.gitignore similarity index 100% rename from tests/auto/corelib/concurrent/qtconcurrentrun/.gitignore rename to tests/auto/concurrent/qtconcurrentrun/.gitignore diff --git a/tests/auto/corelib/concurrent/qtconcurrentrun/qtconcurrentrun.pro b/tests/auto/concurrent/qtconcurrentrun/qtconcurrentrun.pro similarity index 76% rename from tests/auto/corelib/concurrent/qtconcurrentrun/qtconcurrentrun.pro rename to tests/auto/concurrent/qtconcurrentrun/qtconcurrentrun.pro index d4f130fecde..03d77b33a21 100644 --- a/tests/auto/corelib/concurrent/qtconcurrentrun/qtconcurrentrun.pro +++ b/tests/auto/concurrent/qtconcurrentrun/qtconcurrentrun.pro @@ -1,4 +1,4 @@ CONFIG += testcase parallel_test TARGET = tst_qtconcurrentrun -QT = core testlib +QT = core testlib concurrent SOURCES = tst_qtconcurrentrun.cpp diff --git a/tests/auto/corelib/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp similarity index 100% rename from tests/auto/corelib/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp rename to tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp diff --git a/tests/auto/corelib/concurrent/qtconcurrentthreadengine/.gitignore b/tests/auto/concurrent/qtconcurrentthreadengine/.gitignore similarity index 100% rename from tests/auto/corelib/concurrent/qtconcurrentthreadengine/.gitignore rename to tests/auto/concurrent/qtconcurrentthreadengine/.gitignore diff --git a/tests/auto/corelib/concurrent/qtconcurrentthreadengine/qtconcurrentthreadengine.pro b/tests/auto/concurrent/qtconcurrentthreadengine/qtconcurrentthreadengine.pro similarity index 79% rename from tests/auto/corelib/concurrent/qtconcurrentthreadengine/qtconcurrentthreadengine.pro rename to tests/auto/concurrent/qtconcurrentthreadengine/qtconcurrentthreadengine.pro index 536ccc3ea5c..f6ddd33504d 100644 --- a/tests/auto/corelib/concurrent/qtconcurrentthreadengine/qtconcurrentthreadengine.pro +++ b/tests/auto/concurrent/qtconcurrentthreadengine/qtconcurrentthreadengine.pro @@ -1,4 +1,4 @@ CONFIG += testcase parallel_test TARGET = tst_qtconcurrentthreadengine -QT = core testlib +QT = core testlib concurrent SOURCES = tst_qtconcurrentthreadengine.cpp diff --git a/tests/auto/corelib/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp b/tests/auto/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp similarity index 100% rename from tests/auto/corelib/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp rename to tests/auto/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp diff --git a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp index ade17863d90..7daed397d52 100644 --- a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp +++ b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp @@ -47,7 +47,6 @@ #include #include #include -#include #include class tst_QTextCodec : public QObject @@ -55,9 +54,7 @@ class tst_QTextCodec : public QObject Q_OBJECT private slots: -#ifndef QT_NO_CONCURRENT void threadSafety(); -#endif void toUnicode_data(); void toUnicode(); @@ -1939,48 +1936,75 @@ void tst_QTextCodec::toLocal8Bit() } #endif -static QByteArray loadAndConvert(const QByteArray &codecName) +class LoadAndConvert: public QRunnable { - QTextCodec *c = QTextCodec::codecForName(codecName); - if (!c) { - qWarning() << "WARNING" << codecName << "not found?"; - return QByteArray(); +public: + LoadAndConvert(const QByteArray &source, QByteArray *destination) + : codecName(source), target(destination) + {} + QByteArray codecName; + QByteArray *target; + void run() + { + QTextCodec *c = QTextCodec::codecForName(codecName); + if (!c) { + qWarning() << "WARNING" << codecName << "not found?"; + return; + } + QString str = QString::fromLatin1(codecName); + QByteArray b = c->fromUnicode(str); + c->toUnicode(b); + *target = codecName; } - QString str = QString::fromLatin1(codecName); - QByteArray b = c->fromUnicode(str); - c->toUnicode(b); - return codecName; -} +}; -static int loadAndConvertMIB(int mib) +class LoadAndConvertMIB: public QRunnable { - QTextCodec *c = QTextCodec::codecForMib(mib); - if (!c) { - qWarning() << "WARNING" << mib << "not found?"; - return 0; +public: + LoadAndConvertMIB(int mib, int *target) + : mib(mib), target(target) + {} + int mib; + int *target; + void run() + { + QTextCodec *c = QTextCodec::codecForMib(mib); + if (!c) { + qWarning() << "WARNING" << mib << "not found?"; + return; + } + QString str = QString::number(mib); + QByteArray b = c->fromUnicode(str); + c->toUnicode(b); + *target = mib; } - QString str = QString::number(mib); - QByteArray b = c->fromUnicode(str); - c->toUnicode(b); - return mib; -} +}; -#ifndef QT_NO_CONCURRENT void tst_QTextCodec::threadSafety() { QList codecList = QTextCodec::availableCodecs(); QList mibList = QTextCodec::availableMibs(); QThreadPool::globalInstance()->setMaxThreadCount(12); - QFuture res = QtConcurrent::mapped(codecList, loadAndConvert); + QVector res; + res.resize(codecList.size()); + for (int i = 0; i < codecList.size(); ++i) { + QThreadPool::globalInstance()->start(new LoadAndConvert(codecList.at(i), &res[i])); + } - QFuture res2 = QtConcurrent::mapped(mibList, loadAndConvertMIB); + QVector res2; + res2.resize(mibList.size()); + for (int i = 0; i < mibList.size(); ++i) { + QThreadPool::globalInstance()->start(new LoadAndConvertMIB(mibList.at(i), &res2[i])); + } - QCOMPARE(res.results(), codecList); - QCOMPARE(res2.results(), mibList); + // wait for all threads to finish working + QThreadPool::globalInstance()->waitForDone(); + + QCOMPARE(res.toList(), codecList); + QCOMPARE(res2.toList(), mibList); } -#endif void tst_QTextCodec::invalidNames() { diff --git a/tests/auto/corelib/corelib.pro b/tests/auto/corelib/corelib.pro index be12fdab629..4f284ac21e2 100644 --- a/tests/auto/corelib/corelib.pro +++ b/tests/auto/corelib/corelib.pro @@ -2,7 +2,6 @@ TEMPLATE=subdirs SUBDIRS=\ animation \ codecs \ - concurrent \ global \ io \ itemmodels \ @@ -14,4 +13,3 @@ SUBDIRS=\ tools \ xml -!contains(QT_CONFIG, concurrent): SUBDIRS -= concurrent diff --git a/tests/auto/corelib/concurrent/qthreadpool/.gitignore b/tests/auto/corelib/thread/qthreadpool/.gitignore similarity index 100% rename from tests/auto/corelib/concurrent/qthreadpool/.gitignore rename to tests/auto/corelib/thread/qthreadpool/.gitignore diff --git a/tests/auto/corelib/concurrent/qthreadpool/qthreadpool.pro b/tests/auto/corelib/thread/qthreadpool/qthreadpool.pro similarity index 100% rename from tests/auto/corelib/concurrent/qthreadpool/qthreadpool.pro rename to tests/auto/corelib/thread/qthreadpool/qthreadpool.pro diff --git a/tests/auto/corelib/concurrent/qthreadpool/tst_qthreadpool.cpp b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp similarity index 100% rename from tests/auto/corelib/concurrent/qthreadpool/tst_qthreadpool.cpp rename to tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp diff --git a/tests/auto/corelib/thread/thread.pro b/tests/auto/corelib/thread/thread.pro index a137748b75a..12a284c7c7f 100644 --- a/tests/auto/corelib/thread/thread.pro +++ b/tests/auto/corelib/thread/thread.pro @@ -9,6 +9,7 @@ SUBDIRS=\ qsemaphore \ qthread \ qthreadonce \ + qthreadpool \ qthreadstorage \ qwaitcondition \ qwritelocker