mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 23:28:29 +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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user