sched/pthread: Don't do cancel when it is already in the exit process
When the task is already in the exit process, do not execute pthread cancel and return ESRCH. Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
This commit is contained in:
parent
14202651b2
commit
671c5dc3d8
|
@ -65,6 +65,13 @@ int pthread_cancel(pthread_t thread)
|
||||||
return ESRCH;
|
return ESRCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return ESRCH when thread was in exit processing */
|
||||||
|
|
||||||
|
if ((tcb->flags & TCB_FLAG_EXIT_PROCESSING) != 0)
|
||||||
|
{
|
||||||
|
return ESRCH;
|
||||||
|
}
|
||||||
|
|
||||||
/* Only pthreads should use this interface */
|
/* Only pthreads should use this interface */
|
||||||
|
|
||||||
DEBUGASSERT((tcb->flags & TCB_FLAG_TTYPE_MASK) ==
|
DEBUGASSERT((tcb->flags & TCB_FLAG_TTYPE_MASK) ==
|
||||||
|
|
|
@ -328,6 +328,13 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info)
|
||||||
|
|
||||||
DEBUGASSERT(stcb != NULL && info != NULL);
|
DEBUGASSERT(stcb != NULL && info != NULL);
|
||||||
|
|
||||||
|
/* Return ESRCH when thread was in exit processing */
|
||||||
|
|
||||||
|
if ((stcb->flags & TCB_FLAG_EXIT_PROCESSING) != 0)
|
||||||
|
{
|
||||||
|
return -ESRCH;
|
||||||
|
}
|
||||||
|
|
||||||
/* Don't actually send a signal for signo 0. */
|
/* Don't actually send a signal for signo 0. */
|
||||||
|
|
||||||
if (info->si_signo == 0)
|
if (info->si_signo == 0)
|
||||||
|
|
Loading…
Reference in New Issue