deadlock:fix bug,When holder is -1 need stop search next

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2024-04-03 09:54:26 +08:00 committed by Xiang Xiao
parent 6feec8e4c5
commit 3d69dbe1c8
1 changed files with 9 additions and 0 deletions

View File

@ -71,6 +71,11 @@ static void collect_deadlock(FAR struct tcb_s *tcb, FAR void *arg)
size_t i;
next = ((FAR mutex_t *)sem)->holder;
if (next == NXMUTEX_NO_HOLDER)
{
break;
}
for (i = info->found; i < index; i++)
{
if (info->pid[i] == next)
@ -82,6 +87,10 @@ static void collect_deadlock(FAR struct tcb_s *tcb, FAR void *arg)
info->pid[index] = tcb->pid;
tcb = nxsched_get_tcb(next);
if (tcb == NULL)
{
break;
}
}
}
}