summaryrefslogtreecommitdiffstats
path: root/tests/auto/qreadwritelock
diff options
context:
space:
mode:
authorJyri Tahtela <jyri.tahtela@nokia.com>2011-05-18 10:41:09 +0300
committerJyri Tahtela <jyri.tahtela@nokia.com>2011-05-18 10:41:09 +0300
commit9cacde74f7de702689725882633073e60c0a2baa (patch)
tree330d22dadbd28b14a7d8896823d1c33597e9993e /tests/auto/qreadwritelock
parent006c8e22075112eff6230d8168d716e44a9e29d5 (diff)
parent2c07b5d2cba8d8e499bd0861eefef12d4e00d99a (diff)
Merge remote-tracking branch 'qt/4.8'
Conflicts: doc/src/examples/wheel.qdoc src/gui/util/qflickgesture.cpp src/gui/util/qflickgesture_p.h src/gui/util/qscroller.cpp src/gui/util/qscroller.h src/gui/util/qscroller_p.h src/gui/util/qscrollerproperties.cpp src/gui/util/qscrollerproperties.h tests/auto/qscroller/tst_qscroller.cpp
Diffstat (limited to 'tests/auto/qreadwritelock')
-rw-r--r--tests/auto/qreadwritelock/tst_qreadwritelock.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/tests/auto/qreadwritelock/tst_qreadwritelock.cpp b/tests/auto/qreadwritelock/tst_qreadwritelock.cpp
index 99b6850338..720f2b0d67 100644
--- a/tests/auto/qreadwritelock/tst_qreadwritelock.cpp
+++ b/tests/auto/qreadwritelock/tst_qreadwritelock.cpp
@@ -362,34 +362,45 @@ void tst_QReadWriteLock::tryWriteLock()
class Thread : public QThread
{
public:
+ Thread() : failureCount(0) { }
void run()
{
testsTurn.release();
threadsTurn.acquire();
- Q_ASSERT(!readWriteLock.tryLockForWrite());
+ if (readWriteLock.tryLockForWrite())
+ failureCount++;
testsTurn.release();
threadsTurn.acquire();
- Q_ASSERT(readWriteLock.tryLockForWrite());
- Q_ASSERT(lockCount.testAndSetRelaxed(0, 1));
- Q_ASSERT(lockCount.testAndSetRelaxed(1, 0));
+ if (!readWriteLock.tryLockForWrite())
+ failureCount++;
+ if (!lockCount.testAndSetRelaxed(0, 1))
+ failureCount++;
+ if (!lockCount.testAndSetRelaxed(1, 0))
+ failureCount++;
readWriteLock.unlock();
testsTurn.release();
threadsTurn.acquire();
- Q_ASSERT(!readWriteLock.tryLockForWrite(1000));
+ if (readWriteLock.tryLockForWrite(1000))
+ failureCount++;
testsTurn.release();
threadsTurn.acquire();
- Q_ASSERT(readWriteLock.tryLockForWrite(1000));
- Q_ASSERT(lockCount.testAndSetRelaxed(0, 1));
- Q_ASSERT(lockCount.testAndSetRelaxed(1, 0));
+ if (!readWriteLock.tryLockForWrite(1000))
+ failureCount++;
+ if (!lockCount.testAndSetRelaxed(0, 1))
+ failureCount++;
+ if (!lockCount.testAndSetRelaxed(1, 0))
+ failureCount++;
readWriteLock.unlock();
testsTurn.release();
threadsTurn.acquire();
}
+
+ int failureCount;
};
Thread thread;
@@ -419,6 +430,8 @@ void tst_QReadWriteLock::tryWriteLock()
testsTurn.acquire();
threadsTurn.release();
thread.wait();
+
+ QCOMPARE(thread.failureCount, 0);
}
}