From 9fce2db27e664fc3ea8961878ea7f3e8c5c929b2 Mon Sep 17 00:00:00 2001 From: "bernard.xiong" Date: Thu, 8 Sep 2011 02:17:18 +0000 Subject: fixed the scheduling issue in rt_thread_startup; changed the end of line to UNIX style. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1703 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- src/thread.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/thread.c') diff --git a/src/thread.c b/src/thread.c index cde506263d..f7f0bffafe 100644 --- a/src/thread.c +++ b/src/thread.c @@ -11,17 +11,18 @@ * Date Author Notes * 2006-03-28 Bernard first version * 2006-04-29 Bernard implement thread timer - * 2006-04-30 Bernard add THREAD_DEBUG - * 2006-05-27 Bernard fix the rt_thread_yield bug - * 2006-06-03 Bernard fix the thread timer init bug - * 2006-08-10 Bernard fix the timer bug in thread_sleep - * 2006-09-03 Bernard change rt_timer_delete to rt_timer_detach + * 2006-04-30 Bernard added THREAD_DEBUG + * 2006-05-27 Bernard fixed the rt_thread_yield bug + * 2006-06-03 Bernard fixed the thread timer init bug + * 2006-08-10 Bernard fixed the timer bug in thread_sleep + * 2006-09-03 Bernard changed rt_timer_delete to rt_timer_detach * 2006-09-03 Bernard implement rt_thread_detach - * 2008-02-16 Bernard fix the rt_thread_timeout bug + * 2008-02-16 Bernard fixed the rt_thread_timeout bug * 2010-03-21 Bernard change the errno of rt_thread_delay/sleep to RT_EOK. * 2010-11-10 Bernard add cleanup callback function in thread exit. * 2011-09-01 Bernard fixed rt_thread_exit issue when the current thread preempted, * which reported by Jiaxing Lee. + * 2011-09-08 Bernard fixed the scheduling issue in rt_thread_startup. */ #include @@ -213,8 +214,11 @@ rt_err_t rt_thread_startup (rt_thread_t thread) thread->stat = RT_THREAD_SUSPEND; /* then resume it */ rt_thread_resume(thread); - /* do a scheduling */ - rt_schedule(); + if (rt_thread_self() != RT_NULL) + { + /* do a scheduling */ + rt_schedule(); + } return RT_EOK; } -- cgit v1.3.1