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>
This commit is contained in:
parent
cc278a4a78
commit
f116778aed
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user