summaryrefslogtreecommitdiffstats
path: root/src/winmain
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@digia.com>2014-06-19 10:22:16 +0300
committerAndrew Knight <andrew.knight@digia.com>2014-06-25 16:34:39 +0200
commitb46e48f1b72267d14fc4b9e1969f0fc0a4eb739e (patch)
tree29e23b5ab5bcd9bafdb62fbc67471eb111b6ceca /src/winmain
parent50001dc801a695ecd1e6381ff159c0cf2f3c5b55 (diff)
winrt: Use native threading
Instead of using std::thread, use the WinRT ThreadPool to manage threads. This allows for setting the scheduling priority, and provides a path to enable XAML integration (which requires Qt run on a background thread). QThread::terminate() is still unsupported, and only the winmain thread can be adopted due to the behavior of the thread pool when creating tasks from the GUI thread. The associated tests are now skipped, and all other QThread tests pass. Task-number: QTBUG-31397 Change-Id: Ib512a328412e1dffecdc836bc39de3ccd37afa13 Reviewed-by: Oliver Wolff <oliver.wolff@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/winmain')
-rw-r--r--src/winmain/qtmain_winrt.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/winmain/qtmain_winrt.cpp b/src/winmain/qtmain_winrt.cpp
index bcb3445bcd..43bce0862a 100644
--- a/src/winmain/qtmain_winrt.cpp
+++ b/src/winmain/qtmain_winrt.cpp
@@ -67,6 +67,7 @@ extern "C" {
#include <qvector.h>
#include <qdir.h>
#include <qstandardpaths.h>
+#include <qthread.h>
#include <wrl.h>
#include <Windows.ApplicationModel.core.h>
@@ -237,6 +238,9 @@ int __stdcall WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
if (FAILED(RoInitialize(RO_INIT_MULTITHREADED)))
return 1;
+ // Mark the main thread
+ QThread::currentThread();
+
Core::ICoreApplication *appFactory;
if (FAILED(RoGetActivationFactory(qHString(CoreApplicationClass), IID_PPV_ARGS(&appFactory))))
return 2;