fork(5) download
  1. #include <iostream>
  2. #include <thread>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. auto func = [](std::string input)
  8. {
  9. cout << input << ", from " << __FUNCTION__ << endl;
  10. };
  11. func("non threaded");
  12.  
  13. auto id = thread(func, "from thread");
  14. id.join();
  15.  
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 12632KB
stdin
Standard input is empty
stdout
non threaded, from operator()
from thread, from operator()