mempool:fix bug when list needs to be protected by a lock

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2023-02-07 20:49:04 +08:00 committed by Xiang Xiao
parent 4ced3c9642
commit 7347684e5f

View File

@ -394,6 +394,8 @@ int mempool_info(FAR struct mempool_s *pool, FAR struct mempoolinfo_s *info)
int mempool_info_task(FAR struct mempool_s *pool,
FAR struct mempoolinfo_task *info)
{
irqstate_t flags = spin_lock_irqsave(&pool->lock);
DEBUGASSERT(info);
if (info->pid == -2)
{
@ -438,6 +440,7 @@ int mempool_info_task(FAR struct mempool_s *pool,
}
#endif
spin_unlock_irqrestore(&pool->lock, flags);
return OK;
}