multi fork시 wait에서 시그널을 받지 못하는데??
글쓴이: junos2 / 작성시간: 금, 2008/11/07 - 10:44오전
소스코드는 아래와 같이 구성이 되어 있는데.. fork후 execlp로 실행파일까지 잘 실행되고
자식프로세스는 정상 종료되나 wait(&nStatus)에서 신호를 전달받지 못해서 멈춰있는 상태로 있습니다.
어느 부분이 잘못된 것일까요?
int nLoop;
int nStatus;
pid_t pPid[3];
for(nLoop = 0; nLoop<3; nLoop++) {
pPid[nLoop] = fork();
if (pPid[nLoop] == -1) {
perror("fork error");
exit(-1);
} else if (pPid[nLoop]==0) {
nRet = execlp(sExcuteFileFull, sExcuteFile, JobDate, (char *)0);
if (nRet < 0) {
printf("running Error.., %s", strerror(errno));
}
exit(1);
} else {
printf("Parent Process ~~~ pPid[%d]=[%d]", nLoop, pPid[nLoop]);
}
}
for(nLoop = 0; nLoop<3; nLoop++) {
nReturnPid = wait(&nStatus);
}
Forums:


댓글 달기