[src] add assertion for debugging

This commit is contained in:
wangxiaoyao 2023-02-20 13:39:34 +08:00 committed by guo
parent 29c7278edc
commit ed58f6676d
4 changed files with 10 additions and 1 deletions

View File

@ -225,6 +225,7 @@ void rt_cpus_unlock(rt_base_t level)
if (pcpu->current_thread != RT_NULL)
{
RT_ASSERT(pcpu->current_thread->cpus_lock_nest > 0);
pcpu->current_thread->cpus_lock_nest--;
if (pcpu->current_thread->cpus_lock_nest == 0)

View File

@ -292,7 +292,11 @@ static void rt_thread_system_entry(void *parameter)
{
while (1)
{
rt_sem_take(&system_sem, RT_WAITING_FOREVER);
int ret= rt_sem_take(&system_sem, RT_WAITING_FOREVER);
if (ret != RT_EOK)
{
RT_ASSERT(0);
}
rt_defunct_execute();
}
}

View File

@ -666,6 +666,7 @@ void rt_scheduler_do_irq_switch(void *context)
#endif /* RT_USING_OVERFLOW_CHECK */
RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("switch in interrupt\n"));
RT_ASSERT(current_thread->cpus_lock_nest > 0);
current_thread->cpus_lock_nest--;
current_thread->scheduler_lock_nest--;
@ -941,6 +942,7 @@ void rt_enter_critical(void)
{
rt_uint16_t lock_nest = current_thread->cpus_lock_nest;
current_thread->cpus_lock_nest++;
RT_ASSERT(current_thread->cpus_lock_nest != 0);
if (lock_nest == 0)
{
current_thread->scheduler_lock_nest ++;
@ -999,6 +1001,7 @@ void rt_exit_critical(void)
current_thread->critical_lock_nest --;
RT_ASSERT(current_thread->cpus_lock_nest > 0);
current_thread->cpus_lock_nest--;
if (current_thread->cpus_lock_nest == 0)
{

View File

@ -56,6 +56,7 @@ static void _signal_entry(void *parameter)
{
struct rt_cpu* pcpu = rt_cpu_self();
RT_ASSERT(current_thread->cpus_lock_nest > 0);
pcpu->current_thread->cpus_lock_nest--;
if (pcpu->current_thread->cpus_lock_nest == 0)
{