diff options
| author | bernard <[email protected]> | 2013-12-29 22:31:05 +0800 |
|---|---|---|
| committer | bernard <[email protected]> | 2013-12-29 22:31:05 +0800 |
| commit | a93251ae2b61e7a48c2168e08e81dc15f42a92e2 (patch) | |
| tree | dde4cf4909c61c3c0308194aa2c08efe56e16073 /examples/kernel/tc_sample.c | |
| parent | 42ae1c634d9e102091b82bc61ebfe05cccd7fcea (diff) | |
| parent | 939176d13adf7a5a38673f1c836f85fa68cd30be (diff) | |
Merge branch 'master' of https://github.com/RT-Thread/rt-thread
Diffstat (limited to 'examples/kernel/tc_sample.c')
| -rw-r--r-- | examples/kernel/tc_sample.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/examples/kernel/tc_sample.c b/examples/kernel/tc_sample.c index ea77ccda39..212875b716 100644 --- a/examples/kernel/tc_sample.c +++ b/examples/kernel/tc_sample.c @@ -4,59 +4,59 @@ static rt_thread_t tid = RT_NULL; static void sample_thread(void* parameter) { - rt_kprintf("I'm sample!\n"); + rt_kprintf("I'm sample!\n"); } static void sample_thread_cleanup(struct rt_thread *p) { - tid = RT_NULL; - tc_done(TC_STAT_PASSED); + tid = RT_NULL; + tc_done(TC_STAT_PASSED); } int sample_init() { - tid = rt_thread_create("t", - sample_thread, RT_NULL, - THREAD_STACK_SIZE, THREAD_PRIORITY, THREAD_TIMESLICE); - if (tid != RT_NULL) - { - rt_thread_startup(tid); - tid->cleanup = sample_thread_cleanup; - } - else - tc_stat(TC_STAT_END | TC_STAT_FAILED); + tid = rt_thread_create("t", + sample_thread, RT_NULL, + THREAD_STACK_SIZE, THREAD_PRIORITY, THREAD_TIMESLICE); + if (tid != RT_NULL) + { + rt_thread_startup(tid); + tid->cleanup = sample_thread_cleanup; + } + else + tc_stat(TC_STAT_END | TC_STAT_FAILED); - return 0; + return 0; } #ifdef RT_USING_TC static void _tc_cleanup() { - /* lock scheduler */ - rt_enter_critical(); - /* delete thread */ - if (tid != RT_NULL) - { - rt_kprintf("tid1 is bad\n"); - tc_stat(TC_STAT_FAILED); - } - /* unlock scheduler */ - rt_exit_critical(); + /* lock scheduler */ + rt_enter_critical(); + /* delete thread */ + if (tid != RT_NULL) + { + rt_kprintf("tid1 is bad\n"); + tc_stat(TC_STAT_FAILED); + } + /* unlock scheduler */ + rt_exit_critical(); } int _tc_sample() { - /* set tc cleanup */ - tc_cleanup(_tc_cleanup); - sample_init(); + /* set tc cleanup */ + tc_cleanup(_tc_cleanup); + sample_init(); - return 25; + return 25; } FINSH_FUNCTION_EXPORT(_tc_sample, a thread testcase example); #else int rt_application_init() { - sample_init(); + sample_init(); - return 0; + return 0; } #endif |
