[bug][kernel] 保持空闲任务钩子函数调用的原子性

This commit is contained in:
Meco Man 2021-06-02 15:30:32 +08:00
parent f34e9323b4
commit 5a6bc99006
2 changed files with 6 additions and 3 deletions

View File

@ -13,7 +13,8 @@
* 2010-07-13 Bernard fix rt_tick_from_millisecond issue found by kuronca * 2010-07-13 Bernard fix rt_tick_from_millisecond issue found by kuronca
* 2011-06-26 Bernard add rt_tick_set function. * 2011-06-26 Bernard add rt_tick_set function.
* 2018-11-22 Jesven add per cpu tick * 2018-11-22 Jesven add per cpu tick
* 2020-12-29 Meco Man add function rt_tick_get_millisecond() * 2020-12-29 Meco Man implement rt_tick_get_millisecond()
* 2021-06-01 Meco Man add critical section projection for rt_tick_increase()
*/ */
#include <rthw.h> #include <rthw.h>

View File

@ -202,12 +202,14 @@ static void rt_thread_idle_entry(void *parameter)
{ {
#ifdef RT_USING_IDLE_HOOK #ifdef RT_USING_IDLE_HOOK
rt_size_t i; rt_size_t i;
void (*idle_hook)(void);
for (i = 0; i < RT_IDLE_HOOK_LIST_SIZE; i++) for (i = 0; i < RT_IDLE_HOOK_LIST_SIZE; i++)
{ {
if (idle_hook_list[i] != RT_NULL) idle_hook = idle_hook_list[i];
if (idle_hook != RT_NULL)
{ {
idle_hook_list[i](); idle_hook();
} }
} }
#endif #endif