因为我需要在 SIGCHLD 到达时更新作业状态,所以我如何知道 sig_atomic_t 是否已更改值?代码看起来像这样......
sig_atomic_t child_status;
sig_atomic_t child_pid; //is this ok?
void sigHandler(int signum){
pid_t pid;
int status;
while((pid = wait(-1, &status, WNOHANG) > 0){
child_status = status;
child_pid = (int)pid;
}
}