diff options
author | Andrew Knight <andrew.knight@digia.com> | 2014-03-06 14:08:11 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-06 17:22:55 +0100 |
commit | f116778aedacfcff131a5fb20b5439e1a617733a (patch) | |
tree | 51311551c80f9b7bd5b2993477340e03f3206ff2 /src/corelib/thread/qthread_win.cpp | |
parent | cc278a4a78f154235eca0052cedea0bc16ec4931 (diff) |
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 <oliver.wolff@digia.com>
Diffstat (limited to 'src/corelib/thread/qthread_win.cpp')
-rw-r--r-- | src/corelib/thread/qthread_win.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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 |