开发者

how to set up my background process handler

so I'm writing a shell that can have both foreground and background process. I have a:

signal(SIGCHLD, childHandler);

and thus I have handler:

void childHandler(int signum){
    int status开发者_如何学Go, PID;
    PID = waitpid(-1, &signum,WNOHANG);
}

this handler captures both foreground and background children that change state. My shell seems to work for foreground processes. However, as soon as I call a background process, things don't work properly anymore... and I think it may be due to this handler.

Can anyone see if something's wrong/missing?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜