diff options
author | mread <qt-info@nokia.com> | 2011-02-16 15:06:37 (GMT) |
---|---|---|
committer | mread <qt-info@nokia.com> | 2011-03-09 12:46:40 (GMT) |
commit | 6f46333d84c6bbf538dfd06d96b726cd4c3438c1 (patch) | |
tree | 8b222c65aac1502b0a1133f1fdf685d3ed089c35 | |
parent | 7b3d400cafe71cd9d290cc3f485ca67741cdcb33 (diff) | |
download | Qt-6f46333d84c6bbf538dfd06d96b726cd4c3438c1.zip Qt-6f46333d84c6bbf538dfd06d96b726cd4c3438c1.tar.gz Qt-6f46333d84c6bbf538dfd06d96b726cd4c3438c1.tar.bz2 |
tst_qthread now using RThread for Symbian native thread testing
It was using pthreads, but RThreads are the true native threads for
Symbian, so switched to that. The test was passing with pthreads before
this change, and is passing with RThreads after.
Task-number: QTBUG-13990
Reviewed-by: Shane Kearns
-rw-r--r-- | tests/auto/qthread/tst_qthread.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp index 19c6c16..1629b91 100644 --- a/tests/auto/qthread/tst_qthread.cpp +++ b/tests/auto/qthread/tst_qthread.cpp @@ -662,7 +662,9 @@ void tst_QThread::usleep() typedef void (*FunctionPointer)(void *); void noop(void*) { } -#ifdef Q_OS_UNIX +#ifdef Q_OS_SYMBIAN +typedef RThread ThreadHandle; +#elif defined Q_OS_UNIX typedef pthread_t ThreadHandle; #elif defined Q_OS_WIN typedef HANDLE ThreadHandle; @@ -693,6 +695,7 @@ public: protected: static void *runUnix(void *data); static unsigned WIN_FIX_STDCALL runWin(void *data); + static int runSymbian(void *data); FunctionPointer functionPointer; void *data; @@ -702,7 +705,10 @@ void NativeThreadWrapper::start(FunctionPointer functionPointer, void *data) { this->functionPointer = functionPointer; this->data = data; -#ifdef Q_OS_UNIX +#ifdef Q_OS_SYMBIAN + qt_symbian_throwIfError(nativeThreadHandle.Create(KNullDesC(), NativeThreadWrapper::runSymbian, 1024, &User::Allocator(), this)); + nativeThreadHandle.Resume(); +#elif defined Q_OS_UNIX const int state = pthread_create(&nativeThreadHandle, 0, NativeThreadWrapper::runUnix, this); Q_UNUSED(state); #elif defined(Q_OS_WINCE) @@ -722,7 +728,12 @@ void NativeThreadWrapper::startAndWait(FunctionPointer functionPointer, void *da void NativeThreadWrapper::join() { -#ifdef Q_OS_UNIX +#ifdef Q_OS_SYMBIAN + TRequestStatus stat; + nativeThreadHandle.Logon(stat); + User::WaitForRequest(stat); + nativeThreadHandle.Close(); +#elif defined Q_OS_UNIX pthread_join(nativeThreadHandle, 0); #elif defined Q_OS_WIN WaitForSingleObject(nativeThreadHandle, INFINITE); @@ -762,6 +773,12 @@ unsigned WIN_FIX_STDCALL NativeThreadWrapper::runWin(void *data) return 0; } +int NativeThreadWrapper::runSymbian(void *data) +{ + runUnix(data); + return 0; +} + void NativeThreadWrapper::stop() { QMutexLocker lock(&mutex); |