diff --git a/sched/signal/sig_default.c b/sched/signal/sig_default.c index a2c0143857..f70e01e2ee 100644 --- a/sched/signal/sig_default.c +++ b/sched/signal/sig_default.c @@ -303,6 +303,8 @@ static void nxsig_stop_task(int signo) if ((group->tg_waitflags & WUNTRACED) != 0) { + int semvalue; + /* Return zero for exit status (we are not exiting, however) */ if (group->tg_statloc != NULL) @@ -319,11 +321,13 @@ static void nxsig_stop_task(int signo) /* Wakeup any tasks waiting for this task to exit or stop. */ - while (group->tg_exitsem.semcount < 0) + nxsem_get_value(&group->tg_exitsem, &semvalue); + while (semvalue < 0) { /* Wake up the thread */ nxsem_post(&group->tg_exitsem); + nxsem_get_value(&group->tg_exitsem, &semvalue); } } #endif diff --git a/sched/task/task_exithook.c b/sched/task/task_exithook.c index 9b72d34fe0..268931b247 100644 --- a/sched/task/task_exithook.c +++ b/sched/task/task_exithook.c @@ -315,6 +315,7 @@ static inline void nxtask_signalparent(FAR struct tcb_s *ctcb, int status) static inline void nxtask_exitwakeup(FAR struct tcb_s *tcb, int status) { FAR struct task_group_s *group = tcb->group; + int semvalue; /* Have we already left the group? */ @@ -360,11 +361,13 @@ static inline void nxtask_exitwakeup(FAR struct tcb_s *tcb, int status) group->tg_statloc = NULL; group->tg_waitflags = 0; - while (group->tg_exitsem.semcount < 0) + nxsem_get_value(&group->tg_exitsem, &semvalue); + while (semvalue < 0) { /* Wake up the thread */ nxsem_post(&group->tg_exitsem); + nxsem_get_value(&group->tg_exitsem, &semvalue); } } }