pthread: fix pthread exit error when set DETACHED
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
parent
940de60892
commit
c821088734
@ -188,11 +188,12 @@ static void pthread_removejoininfo(FAR struct task_group_s *group,
|
||||
|
||||
int pthread_completejoin(pid_t pid, FAR void *exit_value)
|
||||
{
|
||||
FAR struct task_group_s *group = task_getgroup(pid);
|
||||
FAR struct tcb_s *tcb = nxsched_get_tcb(pid);
|
||||
FAR struct task_group_s *group = tcb ? tcb->group : NULL;
|
||||
FAR struct join_s *pjoin;
|
||||
|
||||
sinfo("pid=%d exit_value=%p group=%p\n", pid, exit_value, group);
|
||||
DEBUGASSERT(group);
|
||||
DEBUGASSERT(group && tcb);
|
||||
|
||||
/* First, find thread's structure in the private data set. */
|
||||
|
||||
@ -200,9 +201,8 @@ int pthread_completejoin(pid_t pid, FAR void *exit_value)
|
||||
pjoin = pthread_findjoininfo(group, pid);
|
||||
if (!pjoin)
|
||||
{
|
||||
serr("ERROR: Could not find join info, pid=%d\n", pid);
|
||||
nxmutex_unlock(&group->tg_joinlock);
|
||||
return ERROR;
|
||||
return tcb->flags & TCB_FLAG_DETACHED ? OK : ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user