sched: Replace direct semaphore value access with nxsem_get_value

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
This commit is contained in:
Jukka Laitinen 2025-04-02 14:37:12 +03:00 committed by Xiang Xiao
parent cd84da8714
commit 4b14b206db
2 changed files with 9 additions and 2 deletions

View File

@ -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

View File

@ -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);
}
}
}