Revert "pthread: Avoid recursive pthread_exit call"

This reverts commit a2941532bd.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
Huang Qi 2022-01-26 10:46:31 +08:00 committed by Xiang Xiao
parent 845640bc33
commit 6814b1416f
5 changed files with 16 additions and 10 deletions

View File

@ -85,9 +85,10 @@ int pthread_cancel(pthread_t thread)
if (tcb == this_task())
{
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
tcb->flags &= ~TCB_FLAG_CANCEL_PENDING;
tcb->flags |= TCB_FLAG_CANCEL_DOING;
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
up_pthread_exit(((FAR struct pthread_tcb_s *)tcb)->exit,
PTHREAD_CANCELED);
#else

View File

@ -217,9 +217,10 @@ static void nxsig_abnormal_termination(int signo)
* REVISIT: This will not work if HAVE_GROUP_MEMBERS is not set.
*/
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
rtcb->flags &= ~TCB_FLAG_CANCEL_PENDING;
rtcb->flags |= TCB_FLAG_CANCEL_DOING;
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
up_pthread_exit(((FAR struct pthread_tcb_s *)rtcb)->exit,
PTHREAD_CANCELED);
#else

View File

@ -141,9 +141,10 @@ bool enter_cancellation_point(void)
if ((tcb->flags & TCB_FLAG_TTYPE_MASK) ==
TCB_FLAG_TTYPE_PTHREAD)
{
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
tcb->flags &= ~TCB_FLAG_CANCEL_PENDING;
tcb->flags |= TCB_FLAG_CANCEL_DOING;
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
up_pthread_exit(((FAR struct pthread_tcb_s *)tcb)->exit,
PTHREAD_CANCELED);
#else
@ -235,9 +236,10 @@ void leave_cancellation_point(void)
if ((tcb->flags & TCB_FLAG_TTYPE_MASK) ==
TCB_FLAG_TTYPE_PTHREAD)
{
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
tcb->flags &= ~TCB_FLAG_CANCEL_PENDING;
tcb->flags |= TCB_FLAG_CANCEL_DOING;
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
up_pthread_exit(((FAR struct pthread_tcb_s *)tcb)->exit,
PTHREAD_CANCELED);
#else

View File

@ -112,9 +112,10 @@ int task_setcancelstate(int state, FAR int *oldstate)
if ((tcb->flags & TCB_FLAG_TTYPE_MASK) ==
TCB_FLAG_TTYPE_PTHREAD)
{
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
tcb->flags &= ~TCB_FLAG_CANCEL_PENDING;
tcb->flags |= TCB_FLAG_CANCEL_DOING;
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
up_pthread_exit(((FAR struct pthread_tcb_s *)tcb)->exit,
PTHREAD_CANCELED);
#else

View File

@ -100,13 +100,14 @@ int task_setcanceltype(int type, FAR int *oldtype)
#ifndef CONFIG_DISABLE_PTHREAD
if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_PTHREAD)
{
tcb->flags &= ~TCB_FLAG_CANCEL_PENDING;
tcb->flags |= TCB_FLAG_CANCEL_DOING;
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
up_pthread_exit(((FAR struct pthread_tcb_s *)tcb)->exit,
PTHREAD_CANCELED);
tcb->flags &= ~TCB_FLAG_CANCEL_PENDING;
tcb->flags |= TCB_FLAG_CANCEL_DOING;
up_pthread_exit(((FAR struct pthread_tcb_s *)tcb)->exit,
PTHREAD_CANCELED);
#else
pthread_exit(PTHREAD_CANCELED);
pthread_exit(PTHREAD_CANCELED);
#endif
}
else