sleep_for.cxx 732 B

12345678910111213141516171819202122232425262728
  1. // Test for std::this_thread::sleep_for().
  2. /* For some reason MinGW's <thread> header seems to be broken.
  3. *
  4. * But it gets worse. It looks as if we can include <thread> without problems
  5. * in this configuration test. Why does it break when MinGW users try to build
  6. * the library, but succeed when we try it here?
  7. *
  8. * To try and get close to the situation in the library code itself, we try
  9. * including some standard headers that we don't strictly need here.
  10. */
  11. #if __has_include(<ciso646>)
  12. # include <ciso646>
  13. #endif
  14. #include <cerrno>
  15. #include <cmath>
  16. #include <cstdlib>
  17. #include <cstring>
  18. #include <new>
  19. #include <chrono>
  20. #include <thread>
  21. int main()
  22. {
  23. std::this_thread::sleep_for(std::chrono::microseconds{10u});
  24. }