diff --git a/libcxx/include/__threading_support b/libcxx/include/__threading_support index 8b0b2eda9b07..aa947139a4e9 100644 --- a/libcxx/include/__threading_support +++ b/libcxx/include/__threading_support @@ -589,14 +589,12 @@ void __libcpp_thread_yield() void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns) { - using namespace _VSTD::chrono; - + using namespace chrono; // round-up to the nearest milisecond milliseconds __ms = duration_cast(__ns + chrono::nanoseconds(999999)); - auto start = system_clock::now(); - while (::SleepEx((__ms - (system_clock::now() - start)).count(), - TRUE) == WAIT_IO_COMPLETION); + // FIXME(compnerd) this should be an alertable sleep (WFSO or SleepEx) + Sleep(__ms.count()); } // Thread Local Storage