summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2012-11-15 18:16:30 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-16 01:37:01 +0100
commit2b308d4cb5cdf2f3374404c83dc0b193fcb78612 (patch)
tree176d133c971aa5a72e7ca0b3e86ae443ed4ba5d9 /tests/auto
parent162926414d2586bdf32f7bc61860772d598beaeb (diff)
Fix QMutex::tryLock timeout computation on Linux
The timeout is in millisecond. So we just need to divide by 1000 to get the number of seconds Regression introduced in f587e8f4fd670f11fa1e878c1015d7241033559a Reported in the comments of QTBUG-24795 Change-Id: Id16e05e7d04d33605860926f7516d14cdefd6a36 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/thread/qmutex/tst_qmutex.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp b/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp
index 3c199b7fc3..7e3e720739 100644
--- a/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp
+++ b/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp
@@ -132,6 +132,14 @@ void tst_QMutex::tryLock()
normalMutex.unlock();
testsTurn.release();
+ // TEST 7 overflow: thread can acquire lock, timeout = 3000 (QTBUG-24795)
+ threadsTurn.acquire();
+ timer.start();
+ QVERIFY(normalMutex.tryLock(3000));
+ QVERIFY(timer.elapsed() < 3000);
+ normalMutex.unlock();
+ testsTurn.release();
+
threadsTurn.acquire();
}
};
@@ -175,6 +183,13 @@ void tst_QMutex::tryLock()
normalMutex.unlock();
threadsTurn.release();
+ // TEST 7: thread can acquire lock, timeout = 3000 (QTBUG-24795)
+ testsTurn.acquire();
+ normalMutex.lock();
+ threadsTurn.release();
+ QThread::msleep(100);
+ normalMutex.unlock();
+
// wait for thread to finish
testsTurn.acquire();
threadsTurn.release();