mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 21:34:07 +08:00
sched: fix pthread_exit crash
A normal user task calls pthread_exit(), will crash at DEBUGASSERT.
Cause pthread_exit limit in user pthread task.
test case:
int main(int argc, FAR char *argv[])
{
pthread_exit(NULL);
return 0;
}
>> test
>> echo $?
>> 0
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
This commit is contained in:
@@ -203,7 +203,10 @@ int pthread_completejoin(pid_t pid, FAR void *exit_value)
|
||||
if (ret != OK)
|
||||
{
|
||||
nxmutex_unlock(&group->tg_joinlock);
|
||||
return tcb->flags & TCB_FLAG_DETACHED ? OK : ERROR;
|
||||
|
||||
return ((tcb->flags & TCB_FLAG_DETACHED) ||
|
||||
(tcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_PTHREAD) ?
|
||||
OK : ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -69,7 +69,6 @@ void nx_pthread_exit(FAR void *exit_value)
|
||||
sinfo("exit_value=%p\n", exit_value);
|
||||
|
||||
DEBUGASSERT(tcb != NULL);
|
||||
DEBUGASSERT((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_PTHREAD);
|
||||
|
||||
/* Block any signal actions that would awaken us while were
|
||||
* are performing the JOIN handshake.
|
||||
|
||||
Reference in New Issue
Block a user