fork(1) download
  1. #include <thread>
  2. #include <future>
  3. #include <functional>
  4. #include <string>
  5. #include <iostream>
  6.  
  7.  
  8. template<class _FN, class... _ARGS>
  9. void runAsync(_FN _fn, _ARGS... _args)
  10. {
  11. auto invoker = std::bind(_fn,_args...);
  12. invoker();
  13. }
  14.  
  15. void fun()
  16. {
  17. std::cout<<"TRUE";
  18. }
  19.  
  20. int main()
  21. {
  22. runAsync(&fun);
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 3344KB
stdin
Standard input is empty
stdout
TRUE