Commit 1cc10903 by Cooper Partin Committed by Geoff Lang

Removed Sleep( ) workaround for Windows Store builds

Visual Studio SDKs now include the ability for Windows Store applications to use the Sleep( ) function. Change-Id: Iaf2a978e778f82e918ba14a58bbb1807cc1fbaf4 Reviewed-on: https://chromium-review.googlesource.com/309890Tested-by: 's avatarCooper Partin <coopp@microsoft.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 0c1d4403
...@@ -797,32 +797,7 @@ void writeFile(const char* path, const void* content, size_t size) ...@@ -797,32 +797,7 @@ void writeFile(const char* path, const void* content, size_t size)
// to run, the function returns immediately, and the thread continues execution. // to run, the function returns immediately, and the thread continues execution.
void ScheduleYield() void ScheduleYield()
{ {
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
// This implementation of Sleep exists because it is not available prior to Update 4.
static HANDLE singletonEvent = nullptr;
HANDLE sleepEvent = singletonEvent;
if (!sleepEvent)
{
sleepEvent = CreateEventEx(nullptr, nullptr, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS);
if (!sleepEvent)
return;
HANDLE previousEvent = InterlockedCompareExchangePointerRelease(&singletonEvent, sleepEvent, nullptr);
if (previousEvent)
{
// Back out if multiple threads try to demand create at the same time.
CloseHandle(sleepEvent);
sleepEvent = previousEvent;
}
}
// Emulate sleep by waiting with timeout on an event that is never signalled.
WaitForSingleObjectEx(sleepEvent, 0, false);
#else
Sleep(0); Sleep(0);
#endif
} }
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment