mirror of
https://github.com/apache/nuttx.git
synced 2025-05-08 22:32:04 +08:00
sched: Replace direct semaphore value access with nxsem_get_value
Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
This commit is contained in:
parent
cd84da8714
commit
4b14b206db
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user