diff --git a/components/lwp/lwp.c b/components/lwp/lwp.c index f5435bcea51..444cebe4c55 100644 --- a/components/lwp/lwp.c +++ b/components/lwp/lwp.c @@ -166,8 +166,6 @@ uint32_t *lwp_get_kernel_sp(void) /* lwp-thread clean up routine */ void lwp_cleanup(struct rt_thread *tid) { - struct rt_lwp *lwp; - if (tid == NULL) { LOG_I("%s: invalid parameter tid == NULL", __func__); @@ -176,18 +174,8 @@ void lwp_cleanup(struct rt_thread *tid) else LOG_D("cleanup thread: %s, stack_addr: 0x%x", tid->parent.name, tid->stack_addr); - /** - * Brief: lwp thread cleanup - * - * Note: Critical Section - * - thread control block (RW. It's ensured that no one else can access tcb - * other than itself) - */ - lwp = (struct rt_lwp *)tid->lwp; lwp_thread_signal_detach(&tid->signal); - /* tty will be release in lwp_ref_dec() if ref is cleared */ - lwp_ref_dec(lwp); return; } diff --git a/components/lwp/lwp_pid.c b/components/lwp/lwp_pid.c index 34285598dfb..14e5d61b4b3 100644 --- a/components/lwp/lwp_pid.c +++ b/components/lwp/lwp_pid.c @@ -604,6 +604,8 @@ void _thread_exit(rt_lwp_t lwp, rt_thread_t thread) lwp_tid_put(thread->tid); thread->tid = 0; + lwp_ref_dec(lwp); + rt_thread_delete(thread); rt_schedule(); while (1) ;