posix_process_alive.cpp 404 B

1234567891011121314151617181920212223242526
  1. #include<__vic/posix/process.h>
  2. #include<iostream>
  3. #include<exception>
  4. #include<cassert>
  5. #include<unistd.h>
  6. void run_tests()
  7. {
  8. assert(__vic::posix::process_alive(::getpid()));
  9. assert(__vic::posix::process_alive(1));
  10. }
  11. int main()
  12. {
  13. try
  14. {
  15. run_tests();
  16. return 0;
  17. }
  18. catch(const std::exception &ex)
  19. {
  20. std::cerr << ex.what() << '\n';
  21. }
  22. return 1;
  23. }