diff options
| author | bernard.xiong <[email protected]> | 2010-03-03 09:12:08 +0000 |
|---|---|---|
| committer | bernard.xiong <[email protected]> | 2010-03-03 09:12:08 +0000 |
| commit | 54d711a9c549845698cb10b70298fae5d4afc74d (patch) | |
| tree | 51b1c55e457a6c50fb550be0a5d1e376fa8160a2 /examples/kernel/tc_comm.c | |
| parent | 51e545f575ce331a233ed199c9265649771e7cc6 (diff) | |
add more thread examples.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@459 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'examples/kernel/tc_comm.c')
| -rw-r--r-- | examples/kernel/tc_comm.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/examples/kernel/tc_comm.c b/examples/kernel/tc_comm.c index ad0a200e88..3f26416b7a 100644 --- a/examples/kernel/tc_comm.c +++ b/examples/kernel/tc_comm.c @@ -37,22 +37,32 @@ void tc_thread_entry(void* parameter) if (tick > 0)
{
result = rt_sem_take(&_tc_sem, tick);
+
+ if (_tc_cleanup != RT_NULL)
+ {
+ /* perform testcase cleanup */
+ _tc_cleanup();
+ _tc_cleanup = RT_NULL;
+ }
+
if (result != RT_EOK)
rt_kprintf("TestCase[%s] failed\n", _tc_current);
else
{
if (_tc_stat & TC_STAT_FAILED)
rt_kprintf("TestCase[%s] failed\n", _tc_current);
- else
+ else
rt_kprintf("TestCase[%s] passed\n", _tc_current);
}
}
-
- if (_tc_cleanup != RT_NULL)
+ else
{
- /* perform testcase cleanup */
- _tc_cleanup();
- _tc_cleanup = RT_NULL;
+ if (_tc_cleanup != RT_NULL)
+ {
+ /* perform testcase cleanup */
+ _tc_cleanup();
+ _tc_cleanup = RT_NULL;
+ }
}
}
}
@@ -126,12 +136,12 @@ void tc_start(const char* tc_prefix) }
rt_memset(_tc_prefix, 0, sizeof(_tc_prefix));
- rt_snprintf(_tc_prefix, sizeof(_tc_prefix),
+ rt_snprintf(_tc_prefix, sizeof(_tc_prefix),
"_tc_%s", tc_prefix);
- result = rt_thread_init(&_tc_thread, "tc",
+ result = rt_thread_init(&_tc_thread, "tc",
tc_thread_entry, RT_NULL,
- &_tc_stack[0], sizeof(_tc_stack),
+ &_tc_stack[0], sizeof(_tc_stack),
TC_PRIORITY - 3, 5);
/* set tc stat */
|
