fork(1) download
  1. #include <iostream>
  2. #include <thread>
  3.  
  4. volatile int run = true;
  5.  
  6. using namespace std;
  7. class thA
  8. {
  9. public:
  10. int fun(int a, int b, int c)
  11. {
  12. return a + b + c;
  13. }
  14. int fun()
  15. {
  16. cout << "Hello World" << endl;
  17. run = false;
  18. return 0;
  19. }
  20. };
  21. int main()
  22. {
  23. thA a;
  24.  
  25. using func = int (thA::*)(void);
  26.  
  27. thread classAAA( func(&thA::fun), a);
  28.  
  29. classAAA.detach();
  30. while(run){}
  31. return 0;
  32. }
  33.  
Success #stdin #stdout 0.02s 5536KB
stdin
Standard input is empty
stdout
Hello World