diff options
| author | xqyjlj <[email protected]> | 2023-11-06 13:22:27 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-11-06 13:22:27 +0800 |
| commit | fa9b496b2ad33d05871a0691b4a1bbc479b28dde (patch) | |
| tree | cca59183a04cb7c683e0b9aac07d2edbf4f3100d | |
| parent | b51a3420b00502315e608dac0cb33917c235d277 (diff) | |
✨ feat: fix pid recycling (#8225)
| -rw-r--r-- | components/lwp/lwp_pid.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/components/lwp/lwp_pid.c b/components/lwp/lwp_pid.c index e26dfe2017..2b1a342c67 100644 --- a/components/lwp/lwp_pid.c +++ b/components/lwp/lwp_pid.c @@ -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); |
