SIGCHILD signal in java
I create a child process using 'Runtime.getRuntime().exec()' in java and wa开发者_开发技巧nt to detect when child process exits. so i want to know is there any signal like 'SIGCHILD' in posix?
No, not precisely. You can call Process.waitFor()
to wait for the process to exit. If you did that from a dedicated thread, however, that would be quite similar to a signal handler. Alternatively, a more expensive method is to poll Process.exitValue()
, which will throw an exception until the child has actually exited.
精彩评论