feat: fix pid recycling (#8225)

This commit is contained in:
xqyjlj 2023-11-06 13:22:27 +08:00 committed by GitHub
parent b51a3420b0
commit fa9b496b2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 3 deletions

View File

@ -1308,9 +1308,17 @@ static void _resr_cleanup(struct rt_lwp *lwp)
/** @note safe since the slist node is release */
LWP_UNLOCK(lwp);
LWP_LOCK(child);
child->sibling = RT_NULL;
/* info: this may cause an orphan lwp */
child->parent = RT_NULL;
if (child->terminated)
{
lwp_pid_put(child);
}
else
{
child->sibling = RT_NULL;
/* info: this may cause an orphan lwp */
child->parent = RT_NULL;
}
LWP_UNLOCK(child);
lwp_ref_dec(child);
lwp_ref_dec(lwp);