diff options
Diffstat (limited to 'include/rtthread.h')
| -rw-r--r-- | include/rtthread.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/rtthread.h b/include/rtthread.h index 93fd138334..7ccf3b56c6 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -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 |
