fork(1) download
  1. #include <boost/test/included/prg_exec_monitor.hpp>
  2. #include <boost/test/execution_monitor.hpp>
  3. #include <exception>
  4. #include <iostream>
  5. #include <ostream>
  6.  
  7. using namespace std;
  8.  
  9. void myterminate ()
  10. {
  11. cerr << "terminate handler called\n";
  12. }
  13. int terminator()
  14. {
  15. terminate();
  16. }
  17. int cpp_main( int, char* [] )
  18. {
  19. set_terminate(myterminate);
  20. boost::execution_monitor m;
  21. try
  22. {
  23. m.execute(terminator);
  24. }
  25. catch ( boost::execution_exception const& ex )
  26. {
  27. cout << "Caught exception: " << ex.what() << endl;
  28. }
  29. cout << "Alive!" << endl;
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0.01s 2852KB
stdin
Standard input is empty
stdout
Caught exception: signal: SIGABRT (application abort requested)
Alive!