forked from mindspore-Ecosystem/mindspore
Add SIG_CHLD signal handler back, and remove SIG_IGN.
This commit is contained in:
parent
55751c6c33
commit
28d7ab48a8
|
@ -152,7 +152,7 @@ void DuplexPipe::Close() {
|
|||
DuplexPipe::SignalHandler::SignalHandler(std::shared_ptr<DuplexPipe> dp, pid_t pid) {
|
||||
dp_ = dp;
|
||||
child_pid_ = pid;
|
||||
signal(SIGCHLD, SIG_IGN);
|
||||
signal(SIGCHLD, SigChildHandler);
|
||||
signal(SIGPIPE, SigPipeHandler);
|
||||
}
|
||||
|
||||
|
@ -178,4 +178,9 @@ void DuplexPipe::SignalHandler::SigPipeHandler(int sig) {
|
|||
dp_->NotifyFinalize();
|
||||
}
|
||||
}
|
||||
|
||||
void DuplexPipe::SignalHandler::SigChildHandler(int sig) {
|
||||
int status;
|
||||
(void)waitpid(child_pid_, &status, WNOHANG | WUNTRACED);
|
||||
}
|
||||
} // namespace mindspore
|
||||
|
|
|
@ -118,6 +118,7 @@ class DuplexPipe : public std::enable_shared_from_this<mindspore::DuplexPipe> {
|
|||
private:
|
||||
static void SigAlarmHandler(int sig);
|
||||
static void SigPipeHandler(int sig);
|
||||
static void SigChildHandler(int sig);
|
||||
|
||||
inline static std::shared_ptr<DuplexPipe> dp_;
|
||||
inline static pid_t child_pid_;
|
||||
|
|
Loading…
Reference in New Issue