net_bufpool.c:when timeout value is zero,It don't break netlock

Resolve some timing issues caused by calling net_breaklock to release netlock in the function NET_BUFPOOL_TRYALLOC

Signed-off-by: wangchen <wangchen41@xiaomi.com>
This commit is contained in:
wangchen
2025-05-26 12:55:24 +08:00
committed by Matteo Golin
parent 9053b60eb2
commit 678164bf4e
+9 -1
View File
@@ -107,7 +107,15 @@ FAR void *net_bufpool_timedalloc(FAR struct net_bufpool_s *pool,
DEBUGASSERT(pool->nodesize > 0);
}
ret = net_sem_timedwait_uninterruptible(&pool->sem, timeout);
if (timeout == 0)
{
ret = nxsem_trywait(&pool->sem);
}
else
{
ret = net_sem_timedwait_uninterruptible(&pool->sem, timeout);
}
if (ret != OK)
{
return NULL;