Merge pull request #4758 from mysterywolf/protect

[bug][kernel] 保持空闲任务钩子函数调用的原子性
This commit is contained in:
Bernard Xiong 2021-06-03 20:23:00 +08:00 committed by GitHub
commit e984037e44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
* 2011-06-26 Bernard add rt_tick_set function.
* 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>

View File

@ -202,12 +202,14 @@ static void rt_thread_idle_entry(void *parameter)
{
#ifdef RT_USING_IDLE_HOOK
rt_size_t i;
void (*idle_hook)(void);
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