summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2013-08-29 16:03:19 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-26 17:26:51 +0200
commitd7af71b3187d9b67eb2aec04197fd41f74149497 (patch)
treef3b7f418235c42a2c6af28ba0532c965f3dcc056 /tests/auto
parent9260a3917a0e0b067e62d1c4bd6343a22656b495 (diff)
threading support for winrt
Change-Id: Ife296e15ddf727c3f53ab3d3d84634b5c7bbf85c Done-with: Maurice Kalinowski Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/thread/qthread/tst_qthread.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
index 5cc0e5bdb4..4ebdd63b99 100644
--- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp
+++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
@@ -55,6 +55,8 @@
#endif
#if defined(Q_OS_WINCE)
#include <windows.h>
+#elif defined(Q_OS_WINRT)
+#include <thread>
#elif defined(Q_OS_WIN)
#include <process.h>
#include <windows.h>
@@ -460,6 +462,10 @@ void tst_QThread::start()
QVERIFY(!thread.isFinished());
QVERIFY(!thread.isRunning());
QMutexLocker locker(&thread.mutex);
+#ifdef Q_OS_WINRT
+ if (priorities[i] != QThread::NormalPriority && priorities[i] != QThread::InheritPriority)
+ QTest::ignoreMessage(QtWarningMsg, "QThread::start: Failed to set thread priority (not implemented)");
+#endif
thread.start(priorities[i]);
QVERIFY(thread.isRunning());
QVERIFY(!thread.isFinished());
@@ -630,6 +636,8 @@ void noop(void*) { }
#if defined Q_OS_UNIX
typedef pthread_t ThreadHandle;
+#elif defined Q_OS_WINRT
+ typedef std::thread ThreadHandle;
#elif defined Q_OS_WIN
typedef HANDLE ThreadHandle;
#endif
@@ -671,6 +679,8 @@ 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)
+ nativeThreadHandle = std::thread(NativeThreadWrapper::runWin, this);
#elif defined(Q_OS_WINCE)
nativeThreadHandle = CreateThread(NULL, 0 , (LPTHREAD_START_ROUTINE)NativeThreadWrapper::runWin , this, 0, NULL);
#elif defined Q_OS_WIN
@@ -690,6 +700,8 @@ void NativeThreadWrapper::join()
{
#if defined Q_OS_UNIX
pthread_join(nativeThreadHandle, 0);
+#elif defined Q_OS_WINRT
+ nativeThreadHandle.join();
#elif defined Q_OS_WIN
WaitForSingleObject(nativeThreadHandle, INFINITE);
CloseHandle(nativeThreadHandle);