[kernel] fixup of data racing accessing percpu objects (#8475)

Signed-off-by: Shell <smokewood@qq.com>
This commit is contained in:
Shell
2024-01-09 23:09:49 +08:00
committed by GitHub
parent acaa23052f
commit cc157baf23
7 changed files with 44 additions and 9 deletions

View File

@@ -835,6 +835,16 @@ while (0)
#define RT_DEBUG_SCHEDULER_AVAILABLE(need_check)
#endif /* RT_DEBUGING_CONTEXT */
rt_inline rt_bool_t rt_in_thread_context(void)
{
return rt_thread_self() != RT_NULL && rt_interrupt_get_nest() == 0;
}
rt_inline rt_bool_t rt_scheduler_is_available(void)
{
return !rt_hw_interrupt_is_disabled() && rt_critical_level() == 0 && rt_in_thread_context();
}
/**@}*/
#ifdef __cplusplus