TC: semaphore_dynamic: code cleanup

This commit is contained in:
Grissiom 2013-12-18 21:39:03 +08:00
parent 4434c87a71
commit c6c6b5ef74
1 changed files with 6 additions and 3 deletions

View File

@ -90,13 +90,16 @@ static void _tc_cleanup()
/* 调度器上锁,上锁后,将不再切换到其他线程,仅响应中断 */ /* 调度器上锁,上锁后,将不再切换到其他线程,仅响应中断 */
rt_enter_critical(); rt_enter_critical();
if (sem)
{
rt_sem_delete(sem);
sem = RT_NULL;
}
/* 删除线程 */ /* 删除线程 */
if (tid != RT_NULL && tid->stat != RT_THREAD_CLOSE) if (tid != RT_NULL && tid->stat != RT_THREAD_CLOSE)
{ {
rt_thread_delete(tid); rt_thread_delete(tid);
/* 删除信号量 */
rt_sem_delete(sem);
} }
/* 调度器解锁 */ /* 调度器解锁 */