summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp')
-rw-r--r--tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
index 60e8d8cba2..49ce918caf 100644
--- a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
+++ b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
@@ -64,6 +64,7 @@ public:
private slots:
void runFunction();
+ void runFunction2();
void createThreadRunFunction();
void runMultiple();
void waitcomplete();
@@ -160,17 +161,27 @@ void tst_QThreadPool::runFunction()
{
QThreadPool manager;
testFunctionCount = 0;
- manager.start(createTask(noSleepTestFunction));
+ manager.start(noSleepTestFunction);
}
QCOMPARE(testFunctionCount, 1);
}
+void tst_QThreadPool::runFunction2()
+{
+ int localCount = 0;
+ {
+ QThreadPool manager;
+ manager.start([&]() { ++localCount; });
+ }
+ QCOMPARE(localCount, 1);
+}
+
void tst_QThreadPool::createThreadRunFunction()
{
{
QThreadPool manager;
testFunctionCount = 0;
- manager.start(createTask(noSleepTestFunction));
+ manager.start(noSleepTestFunction);
}
QCOMPARE(testFunctionCount, 1);
@@ -184,7 +195,7 @@ void tst_QThreadPool::runMultiple()
QThreadPool manager;
testFunctionCount = 0;
for (int i = 0; i < runs; ++i) {
- manager.start(createTask(sleepTestFunctionMutex));
+ manager.start(sleepTestFunctionMutex);
}
}
QCOMPARE(testFunctionCount, runs);
@@ -193,7 +204,7 @@ void tst_QThreadPool::runMultiple()
QThreadPool manager;
testFunctionCount = 0;
for (int i = 0; i < runs; ++i) {
- manager.start(createTask(noSleepTestFunctionMutex));
+ manager.start(noSleepTestFunctionMutex);
}
}
QCOMPARE(testFunctionCount, runs);
@@ -201,7 +212,7 @@ void tst_QThreadPool::runMultiple()
{
QThreadPool manager;
for (int i = 0; i < 500; ++i)
- manager.start(createTask(emptyFunct));
+ manager.start(emptyFunct);
}
}
@@ -211,7 +222,7 @@ void tst_QThreadPool::waitcomplete()
const int runs = 500;
for (int i = 0; i < 500; ++i) {
QThreadPool pool;
- pool.start(createTask(noSleepTestFunction));
+ pool.start(noSleepTestFunction);
}
QCOMPARE(testFunctionCount, runs);
}