diff options
| author | geniusgogo <[email protected]> | 2013-12-22 21:28:30 +0800 |
|---|---|---|
| committer | geniusgogo <[email protected]> | 2013-12-22 21:28:30 +0800 |
| commit | 8b1b64567a090ae2df28ae677c896b14241780c2 (patch) | |
| tree | 717c1cda4915c76830978126a9042df3a9a9b4d0 /src | |
| parent | 30d6196c22695e5a3f6eb5055871890e716b0056 (diff) | |
| parent | 99d56ba766035abd845acc0ba0f5efee5e2fec55 (diff) | |
Merge branch 'master' of https://github.com/RT-Thread/rt-thread
Diffstat (limited to 'src')
| -rw-r--r-- | src/idle.c | 7 | ||||
| -rw-r--r-- | src/scheduler.c | 10 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/idle.c b/src/idle.c index ff3fde21c5..7bca6c28cb 100644 --- a/src/idle.c +++ b/src/idle.c @@ -22,6 +22,8 @@ * 2006-03-23 Bernard the first version * 2010-11-10 Bernard add cleanup callback function in thread exit. * 2012-12-29 Bernard fix compiling warning. + * 2013-12-21 Grissiom let rt_thread_idle_excute loop until there is no + * dead thread. */ #include <rthw.h> @@ -72,8 +74,9 @@ void rt_thread_idle_sethook(void (*hook)(void)) */ void rt_thread_idle_excute(void) { - /* check the defunct thread list */ - if (!rt_list_isempty(&rt_thread_defunct)) + /* Loop until there is no dead thread. So one call to rt_thread_idle_excute + * will do all the cleanups. */ + while (!rt_list_isempty(&rt_thread_defunct)) { rt_base_t lock; rt_thread_t thread; diff --git a/src/scheduler.c b/src/scheduler.c index cefc5b8c41..a0384e899a 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -34,6 +34,7 @@ * issue found by kuronca * 2010-12-13 Bernard add defunct list initialization even if not use heap. * 2011-05-10 Bernard clean scheduler debug log. + * 2013-12-21 Grissiom add rt_critical_level */ #include <rtthread.h> @@ -398,5 +399,14 @@ void rt_exit_critical(void) } } +/** + * Get the scheduler lock level + * + * @return the level of the scheduler lock. 0 means unlocked. + */ +rt_uint16_t rt_critical_level(void) +{ + return rt_scheduler_lock_nest; +} /*@}*/ |
