2016-01-26 25 views
0

有人可以解釋什麼waitpid()調用與WUNTRACED選項用於?我明白,沒有任何標誌的waitpid和pid參數中的-1會在小孩退出時返回。該手冊頁說waitpid與WUNTRACED

If the WUNTRACED option is set, children of the current process 
that are stopped due to a SIGTTIN, SIGTTOU, SIGTSTP, or SIGSTOP signal 
also have their status reported. 

我不明白這可能會用到。謝謝!

回答

1

waitpid()函數不會讓您繼續執行,直到您從給定的pid獲得狀態報告。例如,如果該pid獲得SIGSTOP,並且您沒有提供WUNTRACED選項的功能,則程序仍會等待waitpid()中的狀態報告。