select: fix too small timeout will be counted as 0

avoiding timeouts less than 1ms may lead to busyloop

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu
2025-02-14 13:59:51 +08:00
committed by Xiang Xiao
parent 4d1b54a1b9
commit 82f4b2cbad
+1 -1
View File
@@ -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
{