summaryrefslogtreecommitdiffstats
path: root/tests/auto/qthread
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2010-04-21 07:14:07 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2010-04-21 07:14:07 (GMT)
commitd420eb68b9a306f0fccf3000a8af31aa00cb0cd9 (patch)
tree44c958741cd0189acd5ac875d57d28165f051aae /tests/auto/qthread
parent202af3021362d3c8066bc479a95e7aad889bd928 (diff)
parentb72f9dacb352aa4be888c5f7f1a482dbcba1f456 (diff)
downloadQt-d420eb68b9a306f0fccf3000a8af31aa00cb0cd9.zip
Qt-d420eb68b9a306f0fccf3000a8af31aa00cb0cd9.tar.gz
Qt-d420eb68b9a306f0fccf3000a8af31aa00cb0cd9.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests/auto/qthread')
-rw-r--r--tests/auto/qthread/tst_qthread.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp
index 871578e..9a4397e 100644
--- a/tests/auto/qthread/tst_qthread.cpp
+++ b/tests/auto/qthread/tst_qthread.cpp
@@ -174,8 +174,8 @@ public:
void run()
{
+ Simple_Thread::run();
if (object) {
- Simple_Thread::run();
object->thread = this;
object->code = code;
QTimer::singleShot(100, object, SLOT(slot()));
@@ -218,8 +218,8 @@ public:
void run()
{
+ Simple_Thread::run();
if (object) {
- Simple_Thread::run();
object->thread = this;
QTimer::singleShot(100, object, SLOT(slot()));
}
@@ -443,22 +443,24 @@ void tst_QThread::exit()
thread2.code = 53;
thread2.result = 0;
thread2.start();
- thread2.exit(thread.code);
+ thread2.exit(thread2.code);
+ QMutexLocker locker2(&thread2.mutex);
+ thread2.cond.wait(locker2.mutex());
QVERIFY(thread2.wait(five_minutes));
- QCOMPARE(thread.result, thread.code);
+ QCOMPARE(thread2.result, thread2.code);
}
void tst_QThread::start()
{
QThread::Priority priorities[] = {
- QThread::IdlePriority,
- QThread::LowestPriority,
- QThread::LowPriority,
- QThread::NormalPriority,
- QThread::HighPriority,
- QThread::HighestPriority,
- QThread::TimeCriticalPriority,
- QThread::InheritPriority
+ QThread::IdlePriority,
+ QThread::LowestPriority,
+ QThread::LowPriority,
+ QThread::NormalPriority,
+ QThread::HighPriority,
+ QThread::HighestPriority,
+ QThread::TimeCriticalPriority,
+ QThread::InheritPriority
};
const int prio_count = sizeof(priorities) / sizeof(QThread::Priority);
@@ -514,8 +516,10 @@ void tst_QThread::quit()
thread2.result = -1;
thread2.start();
thread2.quit();
+ QMutexLocker locker2(&thread2.mutex);
+ thread2.cond.wait(locker2.mutex());
QVERIFY(thread2.wait(five_minutes));
- QCOMPARE(thread.result, 0);
+ QCOMPARE(thread2.result, 0);
}
void tst_QThread::wait()
@@ -692,7 +696,7 @@ void NativeThreadWrapper::start(FunctionPointer functionPointer, void *data)
const int state = pthread_create(&nativeThreadHandle, 0, NativeThreadWrapper::runUnix, this);
Q_UNUSED(state);
#elif defined(Q_OS_WINCE)
- nativeThreadHandle = CreateThread(NULL, 0 , (LPTHREAD_START_ROUTINE)NativeThreadWrapper::runWin , this, 0, NULL);
+ nativeThreadHandle = CreateThread(NULL, 0 , (LPTHREAD_START_ROUTINE)NativeThreadWrapper::runWin , this, 0, NULL);
#elif defined Q_OS_WIN
unsigned thrdid = 0;
nativeThreadHandle = (Qt::HANDLE) _beginthreadex(NULL, 0, NativeThreadWrapper::runWin, this, 0, &thrdid);