mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 13:27:01 +08:00
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:
@@ -107,7 +107,15 @@ FAR void *net_bufpool_timedalloc(FAR struct net_bufpool_s *pool,
|
|||||||
DEBUGASSERT(pool->nodesize > 0);
|
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)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user