diff options
Diffstat (limited to 'tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp')
-rw-r--r-- | tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp index f3eba5c823..49a3b3e4db 100644 --- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp +++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp @@ -40,10 +40,8 @@ #include <pthread.h> #endif #ifdef Q_OS_WIN -#ifndef Q_OS_WINCE -#include <process.h> -#endif -#include <windows.h> +# include <process.h> +# include <qt_windows.h> #endif class tst_QThreadStorage : public QObject @@ -202,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); @@ -219,13 +224,14 @@ 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; -#if defined(Q_OS_WINCE) - thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)testAdoptedThreadStorageWin, &pointers, 0, NULL); -#else thread = (HANDLE)_beginthread(testAdoptedThreadStorageWin, 0, &pointers); -#endif QVERIFY(thread); WaitForSingleObject(thread, INFINITE); #endif |