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:
Grissiom 2013-12-18 21:36:29 +08:00
parent e9e8e3f3ca
commit 4434c87a71
2 changed files with 10 additions and 0 deletions

View File

@ -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

View File

@ -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);