diff options
| author | Grissiom <[email protected]> | 2013-12-18 21:39:03 +0800 |
|---|---|---|
| committer | Grissiom <[email protected]> | 2013-12-18 21:47:00 +0800 |
| commit | c6c6b5ef74fa3af437c5a3df7ff16ee4f0f41093 (patch) | |
| tree | 84c863c810609814d10c585d8c28f0ae91df1add | |
| parent | 4434c87a7138f796cefd03a90f7625caaeb08f9a (diff) | |
TC: semaphore_dynamic: code cleanup
| -rw-r--r-- | examples/kernel/semaphore_dynamic.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/kernel/semaphore_dynamic.c b/examples/kernel/semaphore_dynamic.c index 7f2c2ffd42..579d9daa9a 100644 --- a/examples/kernel/semaphore_dynamic.c +++ b/examples/kernel/semaphore_dynamic.c @@ -90,13 +90,16 @@ static void _tc_cleanup() /* 调度器上锁,上锁后,将不再切换到其他线程,仅响应中断 */ rt_enter_critical(); + if (sem) + { + rt_sem_delete(sem); + sem = RT_NULL; + } + /* 删除线程 */ if (tid != RT_NULL && tid->stat != RT_THREAD_CLOSE) { rt_thread_delete(tid); - - /* 删除信号量 */ - rt_sem_delete(sem); } /* 调度器解锁 */ |
