diff options
Diffstat (limited to 'tests/auto/concurrent')
-rw-r--r-- | tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp | 20 | ||||
-rw-r--r-- | tests/auto/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp | 40 |
2 files changed, 30 insertions, 30 deletions
diff --git a/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp b/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp index 3dd77ed3d0..574c82b78e 100644 --- a/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp +++ b/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp @@ -89,7 +89,7 @@ class PrintFor : public IterateKernel<TestIterator, void> { public: PrintFor(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, void>(QThreadPool::globalInstance(), begin, end) { iterations.storeRelaxed(0); } - bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) + bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) override { iterations.fetchAndAddRelaxed(end - begin); #ifdef PRINT @@ -97,7 +97,7 @@ public: #endif return false; } - bool runIteration(TestIterator it, int index , void *result) + bool runIteration(TestIterator it, int index , void *result) override { return runIterations(it, index, index + 1, result); } @@ -108,7 +108,7 @@ class SleepPrintFor : public IterateKernel<TestIterator, void> { public: SleepPrintFor(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, void>(QThreadPool::globalInstance(), begin, end) { iterations.storeRelaxed(0); } - inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) + inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) override { QTest::qSleep(200); iterations.fetchAndAddRelaxed(end - begin); @@ -117,7 +117,7 @@ public: #endif return false; } - bool runIteration(TestIterator it, int index , void *result) + bool runIteration(TestIterator it, int index , void *result) override { return runIterations(it, index, index + 1, result); } @@ -148,12 +148,12 @@ class CountFor : public IterateKernel<TestIterator, void> { public: CountFor(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, void>(QThreadPool::globalInstance(), begin, end) { iterations.storeRelaxed(0); } - inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) + inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) override { counter.fetchAndAddRelaxed(end - begin); return false; } - bool runIteration(TestIterator it, int index , void *result) + bool runIteration(TestIterator it, int index , void *result) override { return runIterations(it, index, index + 1, result); } @@ -187,7 +187,7 @@ public: // and then records how many threads that run between // iterations 140 and 160. ThrottleFor(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, void>(QThreadPool::globalInstance(), begin, end) { iterations.storeRelaxed(0); throttling = false; } - inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) + inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) override { if (200 >= begin && 200 < end) { throttling = false; @@ -210,12 +210,12 @@ public: return false; } - bool runIteration(TestIterator it, int index , void *result) + bool runIteration(TestIterator it, int index , void *result) override { return runIterations(it, index, index + 1, result); } - bool shouldThrottleThread() + bool shouldThrottleThread() override { const int load = iterations.loadRelaxed(); return (load > 100 && load < 200); @@ -243,7 +243,7 @@ class MultipleResultsFor : public IterateKernel<TestIterator, int> { public: MultipleResultsFor(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, int>(QThreadPool::globalInstance(), begin, end) { } - inline bool runIterations(TestIterator, int begin, int end, int *results) + inline bool runIterations(TestIterator, int begin, int end, int *results) override { for (int i = begin; i < end; ++i) results[i - begin] = i; diff --git a/tests/auto/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp b/tests/auto/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp index e192dad3bd..a39488fd62 100644 --- a/tests/auto/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp +++ b/tests/auto/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp @@ -56,7 +56,7 @@ class PrintUser : public ThreadEngine<void> { public: PrintUser() : ThreadEngine(QThreadPool::globalInstance()) {} - ThreadFunctionResult threadFunction() + ThreadFunctionResult threadFunction() override { QTest::qSleep(50); QTest::qSleep(100); @@ -86,18 +86,18 @@ public: : ThreadEngine(QThreadPool::globalInstance()) , done(false) { } - bool shouldStartThread() + bool shouldStartThread() override { return !done; } - ThreadFunctionResult threadFunction() + ThreadFunctionResult threadFunction() override { done = true; return ThreadFinished; } - QString *result() + QString *result() override { foo = "Foo"; return &foo; @@ -117,18 +117,18 @@ class VoidResultUser : public ThreadEngine<void> public: VoidResultUser() : ThreadEngine(QThreadPool::globalInstance()) {} - bool shouldStartThread() + bool shouldStartThread() override { return !done; } - ThreadFunctionResult threadFunction() + ThreadFunctionResult threadFunction() override { done = true; return ThreadFinished; } - void *result() + void *result() override { return 0; } @@ -155,12 +155,12 @@ class CancelUser : public ThreadEngine<void> public: CancelUser() : ThreadEngine(QThreadPool::globalInstance()) {} - void *result() + void *result() override { return 0; } - ThreadFunctionResult threadFunction() + ThreadFunctionResult threadFunction() override { while (this->isCanceled() == false) { @@ -198,12 +198,12 @@ public: finishing = false; } - bool shouldStartThread() + bool shouldStartThread() override { return !finishing; } - ThreadFunctionResult threadFunction() + ThreadFunctionResult threadFunction() override { forever { const int local = count.loadRelaxed(); @@ -253,12 +253,12 @@ public: finishing = finishImmediately; } - bool shouldStartThread() + bool shouldStartThread() override { return !finishing; } - ThreadFunctionResult threadFunction() + ThreadFunctionResult threadFunction() override { { QMutexLocker lock(&mutex); @@ -315,12 +315,12 @@ class MultipleResultsUser : public ThreadEngine<int> { public: MultipleResultsUser() : ThreadEngine(QThreadPool::globalInstance()) {} - bool shouldStartThread() + bool shouldStartThread() override { return false; } - ThreadFunctionResult threadFunction() + ThreadFunctionResult threadFunction() override { for (int i = 0; i < 10; ++i) this->reportResult(&i); @@ -344,17 +344,17 @@ void tst_QtConcurrentThreadEngine::multipleResults() class NoThreadsUser : public ThreadEngine<void> { public: - bool shouldStartThread() + bool shouldStartThread() override { return false; } - ThreadFunctionResult threadFunction() + ThreadFunctionResult threadFunction() override { return ThreadFinished; } - void *result() + void *result() override { return 0; } @@ -385,8 +385,8 @@ class SlowUser : public ThreadEngine<void> { public: SlowUser() : ThreadEngine(QThreadPool::globalInstance()) {} - bool shouldStartThread() { return false; } - ThreadFunctionResult threadFunction() { QTest::qSleep(sleepTime); return ThreadFinished; } + bool shouldStartThread() override { return false; } + ThreadFunctionResult threadFunction() override { QTest::qSleep(sleepTime); return ThreadFinished; } }; void tst_QtConcurrentThreadEngine::cancelQueuedSlowUser() |