mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
Revert "libc: Call pthread_exit in user-space by up_pthread_exit"
This reverts commit f4a0b7aedd.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
@@ -24,8 +24,6 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
@@ -85,15 +83,7 @@ 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;
|
||||
|
||||
up_pthread_exit(((FAR struct pthread_tcb_s *)tcb)->exit,
|
||||
PTHREAD_CANCELED);
|
||||
#else
|
||||
pthread_exit(PTHREAD_CANCELED);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Complete pending join operations */
|
||||
|
||||
@@ -79,7 +79,6 @@ const pthread_attr_t g_default_pthread_attr = PTHREAD_ATTR_INITIALIZER;
|
||||
* tcb - Address of the new task's TCB
|
||||
* trampoline - User space pthread startup function
|
||||
* arg - The argument to provide to the pthread on startup.
|
||||
* exit - The user-space pthread exit function
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
@@ -88,8 +87,7 @@ const pthread_attr_t g_default_pthread_attr = PTHREAD_ATTR_INITIALIZER;
|
||||
|
||||
static inline void pthread_tcb_setup(FAR struct pthread_tcb_s *ptcb,
|
||||
pthread_trampoline_t trampoline,
|
||||
pthread_addr_t arg,
|
||||
pthread_exitroutine_t exit)
|
||||
pthread_addr_t arg)
|
||||
{
|
||||
#if CONFIG_TASK_NAME_SIZE > 0
|
||||
/* Copy the pthread name into the TCB */
|
||||
@@ -104,7 +102,6 @@ static inline void pthread_tcb_setup(FAR struct pthread_tcb_s *ptcb,
|
||||
|
||||
ptcb->trampoline = trampoline;
|
||||
ptcb->arg = arg;
|
||||
ptcb->exit = exit;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -196,12 +193,7 @@ static void pthread_start(void)
|
||||
/* The thread has returned (should never happen) */
|
||||
|
||||
DEBUGPANIC();
|
||||
#ifndef CONFIG_BUILD_FLAT
|
||||
ptcb->cmn.flags &= ~TCB_FLAG_CANCEL_PENDING;
|
||||
ptcb->cmn.flags |= TCB_FLAG_CANCEL_DOING;
|
||||
|
||||
up_pthread_exit(ptcb->exit, NULL);
|
||||
#endif
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -223,7 +215,6 @@ static void pthread_start(void)
|
||||
* for the new thread
|
||||
* entry - The new thread starts execution by invoking entry
|
||||
* arg - It is passed as the sole argument of entry
|
||||
* exit - The user-space pthread exit function
|
||||
*
|
||||
* Returned Value:
|
||||
* OK (0) on success; a (non-negated) errno value on failure. The errno
|
||||
@@ -233,8 +224,7 @@ static void pthread_start(void)
|
||||
|
||||
int nx_pthread_create(pthread_trampoline_t trampoline, FAR pthread_t *thread,
|
||||
FAR const pthread_attr_t *attr,
|
||||
pthread_startroutine_t entry, pthread_addr_t arg,
|
||||
pthread_exitroutine_t exit)
|
||||
pthread_startroutine_t entry, pthread_addr_t arg)
|
||||
{
|
||||
FAR struct pthread_tcb_s *ptcb;
|
||||
FAR struct tls_info_s *info;
|
||||
@@ -247,7 +237,6 @@ int nx_pthread_create(pthread_trampoline_t trampoline, FAR pthread_t *thread,
|
||||
bool group_joined = false;
|
||||
|
||||
DEBUGASSERT(trampoline != NULL);
|
||||
DEBUGASSERT(exit != NULL);
|
||||
|
||||
/* If attributes were not supplied, use the default attributes */
|
||||
|
||||
@@ -467,7 +456,7 @@ int nx_pthread_create(pthread_trampoline_t trampoline, FAR pthread_t *thread,
|
||||
* passed by value
|
||||
*/
|
||||
|
||||
pthread_tcb_setup(ptcb, trampoline, arg, exit);
|
||||
pthread_tcb_setup(ptcb, trampoline, arg);
|
||||
|
||||
/* Join the parent's task group */
|
||||
|
||||
|
||||
@@ -217,15 +217,7 @@ 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;
|
||||
|
||||
up_pthread_exit(((FAR struct pthread_tcb_s *)rtcb)->exit,
|
||||
PTHREAD_CANCELED);
|
||||
#else
|
||||
pthread_exit(PTHREAD_CANCELED);
|
||||
#endif
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
@@ -58,7 +58,6 @@
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
#include <nuttx/pthread.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "semaphore/semaphore.h"
|
||||
@@ -141,15 +140,7 @@ 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;
|
||||
|
||||
up_pthread_exit(((FAR struct pthread_tcb_s *)tcb)->exit,
|
||||
PTHREAD_CANCELED);
|
||||
#else
|
||||
pthread_exit(PTHREAD_CANCELED);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -236,15 +227,7 @@ 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;
|
||||
|
||||
up_pthread_exit(((FAR struct pthread_tcb_s *)tcb)->exit,
|
||||
PTHREAD_CANCELED);
|
||||
#else
|
||||
pthread_exit(PTHREAD_CANCELED);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
@@ -112,15 +112,7 @@ 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;
|
||||
|
||||
up_pthread_exit(((FAR struct pthread_tcb_s *)tcb)->exit,
|
||||
PTHREAD_CANCELED);
|
||||
#else
|
||||
pthread_exit(PTHREAD_CANCELED);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
@@ -100,15 +100,7 @@ int task_setcanceltype(int type, FAR int *oldtype)
|
||||
#ifndef CONFIG_DISABLE_PTHREAD
|
||||
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;
|
||||
|
||||
up_pthread_exit(((FAR struct pthread_tcb_s *)tcb)->exit,
|
||||
PTHREAD_CANCELED);
|
||||
#else
|
||||
pthread_exit(PTHREAD_CANCELED);
|
||||
#endif
|
||||
pthread_exit(PTHREAD_CANCELED);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user