开发者

SIGCHILD signal in java

开发者 https://www.devze.com 2023-03-29 01:36 出处:网络
I create a child process using \'Runtime.getRuntime().exec()\' in java and wa开发者_开发技巧nt to detect when child process exits. so i want to knowis there any signal like \'SIGCHILD\' in posix?No, n

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消