fork download
  1.  
  2. #include <iostream>
  3. #include <thread>
  4.  
  5. int main() {
  6. try{
  7. std::thread th([](){ std::cout << __FUNCTION__ << std::endl; });
  8. std::cout << th.joinable() << std::endl;
  9. std::this_thread::sleep_for(std::chrono::microseconds(5000));
  10. std::cout << th.joinable() << std::endl;
  11. th.join();
  12. std::cout << th.joinable() << std::endl;
  13. }catch(std::exception& e){
  14. std::cout << e.what() << std::endl;
  15. }
  16. }
  17.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:9:9: error: 'sleep_for' is not a member of 'std::this_thread'
stdout
Standard output is empty