TC: release the sem in cleanup
The sem that has been created should be deleted. The sem that has been inited should be detached.
This commit is contained in:
parent
e9e8e3f3ca
commit
4434c87a71
|
@ -100,6 +100,12 @@ static void _tc_cleanup()
|
|||
rt_thread_delete(t2);
|
||||
rt_thread_delete(worker);
|
||||
|
||||
if (sem)
|
||||
{
|
||||
rt_sem_delete(sem);
|
||||
sem = RT_NULL;
|
||||
}
|
||||
|
||||
if (t1_count > t2_count)
|
||||
tc_done(TC_STAT_FAILED);
|
||||
else
|
||||
|
|
|
@ -119,6 +119,10 @@ static void _tc_cleanup()
|
|||
/* 调度器上锁,上锁后,将不再切换到其他线程,仅响应中断 */
|
||||
rt_enter_critical();
|
||||
|
||||
rt_sem_detach(&sem_lock);
|
||||
rt_sem_detach(&sem_empty);
|
||||
rt_sem_detach(&sem_full);
|
||||
|
||||
/* 删除线程 */
|
||||
if (producer_tid != RT_NULL && producer_tid->stat != RT_THREAD_CLOSE)
|
||||
rt_thread_delete(producer_tid);
|
||||
|
|
Loading…
Reference in New Issue