1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

always wait for process to terminated when SIGKILL.

This commit is contained in:
winlin 2015-08-26 23:02:54 +08:00
parent 9c2beffe8f
commit fe4cdceb15

View file

@ -274,8 +274,11 @@ int srs_kill_forced(int& pid)
// other signals, directly exit(123), for example: // other signals, directly exit(123), for example:
// 9) SIGKILL 15) SIGTERM // 9) SIGKILL 15) SIGTERM
int status = 0; int status = 0;
if (waitpid(pid, &status, 0) < 0) { // @remark when we use SIGKILL to kill process, it must be killed,
return ERROR_SYSTEM_KILL; // so we always wait it to quit by infinite loop.
while (waitpid(pid, &status, 0) < 0) {
st_usleep(10 * 1000);
continue;
} }
srs_trace("SIGKILL stop process pid=%d ok.", pid); srs_trace("SIGKILL stop process pid=%d ok.", pid);