summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/thread/qthreadstorage
diff options
context:
space:
mode:
authorMaurice Kalinowski <maurice.kalinowski@qt.io>2016-08-09 13:46:42 +0200
committerMaurice Kalinowski <maurice.kalinowski@qt.io>2016-08-09 12:13:23 +0000
commitbd79c4e28c307ba87aca02155b845774c7ffec1f (patch)
tree300946b0e0beee63d0d11f038cc629ca95320c55 /tests/auto/corelib/thread/qthreadstorage
parent7305b3e82863f077c4f677d0a860e314ce6f806c (diff)
winrt: Make test functional
The adoptedThreads test never spawned any thread causing a test error later on. Hence add a winrt version using __beginthreadex which exists for that platform. Change-Id: I04f980218713df20cb41d804d732e0c99b958489 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'tests/auto/corelib/thread/qthreadstorage')
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
index 4e582cc346..49a3b3e4db 100644
--- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
+++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
@@ -200,6 +200,13 @@ void testAdoptedThreadStorageWin(void *p)
}
QObject::connect(QThread::currentThread(), SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
}
+#ifdef Q_OS_WINRT
+unsigned __stdcall testAdoptedThreadStorageWinRT(void *p)
+{
+ testAdoptedThreadStorageWin(p);
+ return 0;
+}
+#endif
void *testAdoptedThreadStorageUnix(void *pointers)
{
testAdoptedThreadStorageWin(pointers);
@@ -217,7 +224,12 @@ void tst_QThreadStorage::adoptedThreads()
const int state = pthread_create(&thread, 0, testAdoptedThreadStorageUnix, &pointers);
QCOMPARE(state, 0);
pthread_join(thread, 0);
-#elif defined Q_OS_WIN && !defined(Q_OS_WINRT)
+#elif defined Q_OS_WINRT
+ HANDLE thread;
+ thread = (HANDLE) _beginthreadex(NULL, 0, testAdoptedThreadStorageWinRT, &pointers, 0, 0);
+ QVERIFY(thread);
+ WaitForSingleObjectEx(thread, INFINITE, FALSE);
+#elif defined Q_OS_WIN
HANDLE thread;
thread = (HANDLE)_beginthread(testAdoptedThreadStorageWin, 0, &pointers);
QVERIFY(thread);