[libcxx] r295561 - Revert "threading_support: make __thread_sleep_for be alertable"

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 18 11:28:44 PST 2017


Author: compnerd
Date: Sat Feb 18 13:28:43 2017
New Revision: 295561

URL: http://llvm.org/viewvc/llvm-project?rev=295561&view=rev
Log:
Revert "threading_support: make __thread_sleep_for be alertable"

This reverts SVN r295329.  Although `__libcpp_thread_sleep_for` should
be alertable, the implementation causes a large regression in the test
suite.  Add a FIXME item there for now to get the test suite in a better
state before attempting to fix that behaviour.

Modified:
    libcxx/trunk/include/__threading_support

Modified: libcxx/trunk/include/__threading_support
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__threading_support?rev=295561&r1=295560&r2=295561&view=diff
==============================================================================
--- libcxx/trunk/include/__threading_support (original)
+++ libcxx/trunk/include/__threading_support Sat Feb 18 13:28:43 2017
@@ -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<milliseconds>(__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




More information about the cfe-commits mailing list