提交 ed58f667 编写于 作者: W wangxiaoyao 提交者: guo

[src] add assertion for debugging

上级 29c7278e
......@@ -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)
......
......@@ -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();
}
}
......
......@@ -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)
{
......
......@@ -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)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册