summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/thread/qthread/tst_qthread.cpp
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@theqtcompany.com>2015-06-10 12:48:17 +0200
committerOliver Wolff <oliver.wolff@theqtcompany.com>2015-06-23 05:47:14 +0000
commitbf24838c3344f009f9fe40f596a4eab798f071b3 (patch)
treea946c012f36cb037a9f412ebe0fbafea0f949094 /tests/auto/corelib/thread/qthread/tst_qthread.cpp
parent4ce05c608410f2574e92bc6c65ad5c830b66b12f (diff)
Use qthread_win.cpp for WinRT as well
Since of Windows (Phone) 8.1 most of the desktop's thread functionality is also available, so we might be able to share the code and get rid of the extra implementation for WinRT. Task-number: QTBUG-43837 Change-Id: I0ce907cd94899834527f88c70e1e395bafdb14b3 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
Diffstat (limited to 'tests/auto/corelib/thread/qthread/tst_qthread.cpp')
-rw-r--r--tests/auto/corelib/thread/qthread/tst_qthread.cpp46
1 files changed, 5 insertions, 41 deletions
diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
index 3bc4bb80b8..3230472d5b 100644
--- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp
+++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
@@ -669,9 +669,7 @@ void NativeThreadWrapper::start(FunctionPointer functionPointer, void *data)
#if defined Q_OS_UNIX
const int state = pthread_create(&nativeThreadHandle, 0, NativeThreadWrapper::runUnix, this);
Q_UNUSED(state);
-#elif defined(Q_OS_WINRT)
- // creating a new worker from within the GUI thread is not supported
-#elif defined(Q_OS_WINCE)
+#elif defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
nativeThreadHandle = CreateThread(NULL, 0 , (LPTHREAD_START_ROUTINE)NativeThreadWrapper::runWin , this, 0, NULL);
#elif defined Q_OS_WIN
unsigned thrdid = 0;
@@ -690,10 +688,12 @@ void NativeThreadWrapper::join()
{
#if defined Q_OS_UNIX
pthread_join(nativeThreadHandle, 0);
-#elif defined Q_OS_WINRT
- // not supported
#elif defined Q_OS_WIN
+#ifndef Q_OS_WINCE
+ WaitForSingleObjectEx(nativeThreadHandle, INFINITE, FALSE);
+#else
WaitForSingleObject(nativeThreadHandle, INFINITE);
+#endif
CloseHandle(nativeThreadHandle);
#endif
}
@@ -747,9 +747,6 @@ void testNativeThreadAdoption(void *)
}
void tst_QThread::nativeThreadAdoption()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
threadAdoptedOk = false;
mainThread = QThread::currentThread();
NativeThreadWrapper nativeThread;
@@ -773,9 +770,6 @@ void adoptedThreadAffinityFunction(void *arg)
void tst_QThread::adoptedThreadAffinity()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
QThread *affinity[2] = { 0, 0 };
NativeThreadWrapper thread;
@@ -788,9 +782,6 @@ void tst_QThread::adoptedThreadAffinity()
void tst_QThread::adoptedThreadSetPriority()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
NativeThreadWrapper nativeThread;
nativeThread.setWaitForStop();
nativeThread.startAndWait();
@@ -818,9 +809,6 @@ void tst_QThread::adoptedThreadSetPriority()
void tst_QThread::adoptedThreadExit()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
NativeThreadWrapper nativeThread;
nativeThread.setWaitForStop();
@@ -850,9 +838,6 @@ void adoptedThreadExecFunction(void *)
void tst_QThread::adoptedThreadExec()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
NativeThreadWrapper nativeThread;
nativeThread.start(adoptedThreadExecFunction);
nativeThread.join();
@@ -863,9 +848,6 @@ void tst_QThread::adoptedThreadExec()
*/
void tst_QThread::adoptedThreadFinished()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
NativeThreadWrapper nativeThread;
nativeThread.setWaitForStop();
nativeThread.startAndWait();
@@ -876,17 +858,11 @@ void tst_QThread::adoptedThreadFinished()
nativeThread.join();
QTestEventLoop::instance().enterLoop(5);
-#if defined(Q_OS_WINRT)
- QEXPECT_FAIL("", "QTBUG-31397: Known not to work on WinRT", Abort);
-#endif
QVERIFY(!QTestEventLoop::instance().timeout());
}
void tst_QThread::adoptedThreadExecFinished()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
NativeThreadWrapper nativeThread;
nativeThread.setWaitForStop();
nativeThread.startAndWait(adoptedThreadExecFunction);
@@ -902,9 +878,6 @@ void tst_QThread::adoptedThreadExecFinished()
void tst_QThread::adoptMultipleThreads()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
#if defined(Q_OS_WIN)
// Windows CE is not capable of handling that many threads. On the emulator it is dead with 26 threads already.
# if defined(Q_OS_WINCE)
@@ -936,18 +909,12 @@ void tst_QThread::adoptMultipleThreads()
}
QTestEventLoop::instance().enterLoop(5);
-#if defined(Q_OS_WINRT)
- QEXPECT_FAIL("", "QTBUG-31397: Known not to work on WinRT", Abort);
-#endif
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(recorder.activationCount.load(), numThreads);
}
void tst_QThread::adoptMultipleThreadsOverlap()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
#if defined(Q_OS_WIN)
// Windows CE is not capable of handling that many threads. On the emulator it is dead with 26 threads already.
# if defined(Q_OS_WINCE)
@@ -984,9 +951,6 @@ void tst_QThread::adoptMultipleThreadsOverlap()
}
QTestEventLoop::instance().enterLoop(5);
-#if defined(Q_OS_WINRT)
- QEXPECT_FAIL("", "QTBUG-31397: Known not to work on WinRT", Abort);
-#endif
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(recorder.activationCount.load(), numThreads);
}