Skip to content

Commit abd7657

Browse files
committed
[lwp]将进程的销毁操作放进本进程环境
1 parent 3c8b235 commit abd7657

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

components/lwp/lwp.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ uint32_t *lwp_get_kernel_sp(void)
166166
/* lwp-thread clean up routine */
167167
void lwp_cleanup(struct rt_thread *tid)
168168
{
169-
struct rt_lwp *lwp;
170-
171169
if (tid == NULL)
172170
{
173171
LOG_I("%s: invalid parameter tid == NULL", __func__);
@@ -176,18 +174,8 @@ void lwp_cleanup(struct rt_thread *tid)
176174
else
177175
LOG_D("cleanup thread: %s, stack_addr: 0x%x", tid->parent.name, tid->stack_addr);
178176

179-
/**
180-
* Brief: lwp thread cleanup
181-
*
182-
* Note: Critical Section
183-
* - thread control block (RW. It's ensured that no one else can access tcb
184-
* other than itself)
185-
*/
186-
lwp = (struct rt_lwp *)tid->lwp;
187177
lwp_thread_signal_detach(&tid->signal);
188178

189-
/* tty will be release in lwp_ref_dec() if ref is cleared */
190-
lwp_ref_dec(lwp);
191179
return;
192180
}
193181

components/lwp/lwp_pid.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,8 @@ void _thread_exit(rt_lwp_t lwp, rt_thread_t thread)
604604
lwp_tid_put(thread->tid);
605605
thread->tid = 0;
606606

607+
lwp_ref_dec(lwp);
608+
607609
rt_thread_delete(thread);
608610
rt_schedule();
609611
while (1) ;

0 commit comments

Comments
 (0)