diff options
| author | Grissiom <[email protected]> | 2013-12-21 11:31:40 +0800 |
|---|---|---|
| committer | Grissiom <[email protected]> | 2013-12-21 11:31:40 +0800 |
| commit | 04f432f47b906e129209daf8e505ac0f6b57ebd0 (patch) | |
| tree | ab486b4638937bfdd31640f7a932f548d9e0b1e2 | |
| parent | 408ac34bc2d762db7019a14cc5caf8af4df57b43 (diff) | |
kernel: let rt_thread_idle_excute loop until there is no dead thread
Out side world is difficult to tell whethere there is dead thread
remaining. If rt_thread_idle_excute only do one cleanup, it's hard to
finish cleanups outside the idle thread. So let is loop and do all the
cleanups in one call.
| -rw-r--r-- | src/idle.c | 7 |
1 files changed, 5 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; |
