mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
network: simplify the timeout process logic
1.Consolidate absolute to relative timeout conversion into one place(_net_timedwait) 2.Drive the wait timeout logic by net_timedwait instead of devif_timer This patch help us remove devif_timer(period tick) to save the power in the future. Change-Id: I534748a5d767ca6da8a7843c3c2f993ed9ea77d4 Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
#include <stdint.h>
|
||||
#include <net/ethernet.h>
|
||||
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/net/ip.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
|
||||
|
||||
@@ -370,7 +370,7 @@ void net_unlock(void);
|
||||
*
|
||||
* Input Parameters:
|
||||
* sem - A reference to the semaphore to be taken.
|
||||
* abstime - The absolute time to wait until a timeout is declared.
|
||||
* timeout - The relative time to wait until a timeout is declared.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
@@ -378,8 +378,7 @@ void net_unlock(void);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
struct timespec;
|
||||
int net_timedwait(sem_t *sem, FAR const struct timespec *abstime);
|
||||
int net_timedwait(sem_t *sem, unsigned int timeout);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: net_lockedwait
|
||||
@@ -412,7 +411,7 @@ int net_lockedwait(sem_t *sem);
|
||||
*
|
||||
* Input Parameters:
|
||||
* sem - A reference to the semaphore to be taken.
|
||||
* abstime - The absolute time to wait until a timeout is declared.
|
||||
* timeout - The relative time to wait until a timeout is declared.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
@@ -420,8 +419,7 @@ int net_lockedwait(sem_t *sem);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int net_timedwait_uninterruptible(sem_t *sem,
|
||||
FAR const struct timespec *abstime);
|
||||
int net_timedwait_uninterruptible(sem_t *sem, unsigned int timeout);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: net_lockedwait_uninterruptible
|
||||
|
||||
Reference in New Issue
Block a user