mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-20 17:44:20 +08:00
add RT_DEBUG_SCHEDULER_AVAILABLE check
This commit is contained in:
@@ -110,9 +110,31 @@ do \
|
||||
rt_hw_interrupt_enable(level); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* "scheduler available" means:
|
||||
* 1) the scheduler has been started.
|
||||
* 2) not in interrupt context.
|
||||
* 3) scheduler is not locked.
|
||||
*/
|
||||
#define RT_DEBUG_SCHEDULER_AVAILABLE \
|
||||
do \
|
||||
{ \
|
||||
rt_base_t level; \
|
||||
level = rt_hw_interrupt_disable(); \
|
||||
if (rt_critical_level() != 0) \
|
||||
{ \
|
||||
rt_kprintf("Function[%s]: scheduler is not available\n", \
|
||||
__FUNCTION__); \
|
||||
RT_ASSERT(0) \
|
||||
} \
|
||||
RT_DEBUG_IN_THREAD_CONTEXT; \
|
||||
rt_hw_interrupt_enable(level); \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
#define RT_DEBUG_NOT_IN_INTERRUPT
|
||||
#define RT_DEBUG_IN_THREAD_CONTEXT
|
||||
#define RT_DEBUG_SCHEDULER_AVAILABLE
|
||||
#endif
|
||||
|
||||
#else /* RT_DEBUG */
|
||||
@@ -121,6 +143,7 @@ while (0)
|
||||
#define RT_DEBUG_LOG(type, message)
|
||||
#define RT_DEBUG_NOT_IN_INTERRUPT
|
||||
#define RT_DEBUG_IN_THREAD_CONTEXT
|
||||
#define RT_DEBUG_SCHEDULER_AVAILABLE
|
||||
|
||||
#endif /* RT_DEBUG */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user