From f116778aedacfcff131a5fb20b5439e1a617733a Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Thu, 6 Mar 2014 14:08:11 +0200 Subject: WinRT: Use native wait methods instead of std::thread's sleep_for sleep_for appears to be unreliable (resulting in infinite waits) when used in a thread which is also using native waiting methods. This is also a step in the direction of eliminating std::thread's usage in WinRT. Change-Id: I58bc4bf9ada25de247849333ef925964676b7239 Reviewed-by: Oliver Wolff --- src/corelib/thread/qthread_win.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/corelib/thread') diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index db5c13157c..a12636778e 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -504,22 +504,22 @@ void QThread::usleep(unsigned long usecs) void QThread::yieldCurrentThread() { - std::this_thread::yield(); + msleep(1); } void QThread::sleep(unsigned long secs) { - std::this_thread::sleep_for(std::chrono::seconds(secs)); + msleep(secs * 1000); } void QThread::msleep(unsigned long msecs) { - std::this_thread::sleep_for(std::chrono::milliseconds(msecs)); + WaitForSingleObjectEx(GetCurrentThread(), msecs, FALSE); } void QThread::usleep(unsigned long usecs) { - std::this_thread::sleep_for(std::chrono::microseconds(usecs)); + msleep((usecs / 1000) + 1); } #endif // Q_OS_WINRT -- cgit v1.2.3