How to properly wait for foreground/background processes in my own shell in C?

后端 未结 4 1320
感动是毒
感动是毒 2021-02-06 06:16

In this previous question I posted most of my own shell code. My next step is to implement foreground and background process execution and properly wait for them to terminate so

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-06 06:43

    You may use:

    if(!background)
        pause();
    

    This way, the process blocks until it receives the SIGCHLD signal, and the signal handler will do the wait stuff.

提交回复
热议问题