mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00: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:
parent
9053b60eb2
commit
678164bf4e
1 changed files with 9 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue