!574 fix: solve SIGCHLD ignored in sigsuspend()

Merge pull request !574 from MGY917/sigsuspend
This commit is contained in:
openharmony_ci 2021-09-08 08:27:12 +00:00 committed by Gitee
commit e095e87682
1 changed files with 15 additions and 3 deletions

View File

@ -575,9 +575,21 @@ int OsSigSuspend(const sigset_t *set)
/* If pending mask not in sigmask, need set sigflag */
OsSigMaskSwitch(rtcb, *set);
ret = OsSigTimedWaitNoLock(&setSuspend, NULL, LOS_WAIT_FOREVER);
if (ret < 0) {
PRINT_ERR("FUNC %s LINE = %d, ret = %x\n", __FUNCTION__, __LINE__, ret);
if (rtcb->sig.sigFlag > 0) {
SCHEDULER_UNLOCK(intSave);
/*
* If rtcb->sig.sigFlag > 0, it means that some signal have been
* received, and we need to do schedule to handle the signal directly.
*/
LOS_Schedule();
return -EINTR;
} else {
ret = OsSigTimedWaitNoLock(&setSuspend, NULL, LOS_WAIT_FOREVER);
if (ret < 0) {
PRINT_ERR("FUNC %s LINE = %d, ret = %x\n", __FUNCTION__, __LINE__, ret);
}
}
SCHEDULER_UNLOCK(intSave);