summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp')
-rw-r--r--tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
index 4969e417f4..1d79d0dd1f 100644
--- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
+++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
@@ -163,13 +163,13 @@ void tst_QLockFile::lockOutOtherThread()
QVERIFY(lockFile.lock());
// Other thread can't acquire lock
- QFuture<QLockFile::LockError> ret = QtConcurrent::run<QLockFile::LockError>(tryLockFromThread, fileName);
+ auto ret = QtConcurrent::run(tryLockFromThread, fileName);
QCOMPARE(ret.result(), QLockFile::LockFailedError);
lockFile.unlock();
// Now other thread can acquire lock
- QFuture<QLockFile::LockError> ret2 = QtConcurrent::run<QLockFile::LockError>(tryLockFromThread, fileName);
+ auto ret2 = QtConcurrent::run(tryLockFromThread, fileName);
QCOMPARE(ret2.result(), QLockFile::NoError);
}
@@ -186,13 +186,13 @@ static QLockFile::LockError lockFromThread(const QString &fileName)
void tst_QLockFile::raceWithOtherThread()
{
const QString fileName = dir.path() + "/raceWithOtherThread";
- QFuture<QLockFile::LockError> ret = QtConcurrent::run<QLockFile::LockError>(lockFromThread, fileName);
- QFuture<QLockFile::LockError> ret2 = QtConcurrent::run<QLockFile::LockError>(lockFromThread, fileName);
+ auto ret = QtConcurrent::run(lockFromThread, fileName);
+ auto ret2 = QtConcurrent::run(lockFromThread, fileName);
QCOMPARE(ret.result(), QLockFile::NoError);
QCOMPARE(ret2.result(), QLockFile::NoError);
}
-static bool lockFromThread(const QString &fileName, int sleepMs, QSemaphore *semThreadReady, QSemaphore *semMainThreadDone)
+static bool lockFromThreadAndWait(const QString &fileName, int sleepMs, QSemaphore *semThreadReady, QSemaphore *semMainThreadDone)
{
QLockFile lockFile(fileName);
if (!lockFile.lock()) {
@@ -233,7 +233,7 @@ void tst_QLockFile::waitForLock()
QLockFile lockFile(fileName);
QSemaphore semThreadReady, semMainThreadDone;
// Lock file from a thread
- QFuture<bool> ret = QtConcurrent::run<bool>(lockFromThread, fileName, threadSleepMs, &semThreadReady, &semMainThreadDone);
+ auto ret = QtConcurrent::run(lockFromThreadAndWait, fileName, threadSleepMs, &semThreadReady, &semMainThreadDone);
semThreadReady.acquire();
if (releaseEarly) // let the thread release the lock after threadSleepMs
@@ -410,7 +410,7 @@ void tst_QLockFile::staleLockRace()
QThreadPool::globalInstance()->setMaxThreadCount(10);
QFutureSynchronizer<QString> synchronizer;
for (int i = 0; i < 8; ++i)
- synchronizer.addFuture(QtConcurrent::run<QString>(tryStaleLockFromThread, fileName));
+ synchronizer.addFuture(QtConcurrent::run(tryStaleLockFromThread, fileName));
synchronizer.waitForFinished();
foreach (const QFuture<QString> &future, synchronizer.futures())
QVERIFY2(future.result().isEmpty(), qPrintable(future.result()));