This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 1bf71795fca select: fix too small timeout will be counted as 0
1bf71795fca is described below
commit 1bf71795fcae0a03a6754f22be6f79794f751bca
Author: zhanghongyu <[email protected]>
AuthorDate: Fri Feb 14 13:59:51 2025 +0800
select: fix too small timeout will be counted as 0
avoiding timeouts less than 1ms may lead to busyloop
Signed-off-by: zhanghongyu <[email protected]>
---
fs/vfs/fs_select.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/vfs/fs_select.c b/fs/vfs/fs_select.c
index d8393a8cb2c..fde14c2a9fb 100644
--- a/fs/vfs/fs_select.c
+++ b/fs/vfs/fs_select.c
@@ -204,7 +204,7 @@ int select(int nfds, FAR fd_set *readfds, FAR fd_set
*writefds,
{
/* Calculate the timeout in milliseconds */
- msec = timeout->tv_sec * 1000 + timeout->tv_usec / 1000;
+ msec = timeout->tv_sec * 1000 + (timeout->tv_usec + 999) / 1000;
}
else
{