Fix pollSockets() with timeout 0 on 3DS

This commit is contained in:
Cameron Gutman committed 2026-11-12 23:48:46 -06:00
1 parent 2804982d91
commit e6b1aaf0b8
1 file changed
+13 -9
+13 -9
View File
@@ -149,17 +149,21 @@ int pollSockets(struct pollfd* pollFds, int pollFdsCount, int timeoutMs) {
return err;
#elif defined(__3DS__)
int err;
u64 poll_start = osGetTime();
// seems like timeoutMs is never negative
for (u64 i = poll_start; (i - poll_start) < (u64)timeoutMs; i = osGetTime()) {
err = poll(pollFds, pollFdsCount, 0); // This is running for 14ms
if (err) {
break;
if (timeoutMs > 0) {
int err;
u64 poll_start = osGetTime();
for (u64 i = poll_start; (i - poll_start) < (u64)timeoutMs; i = osGetTime()) {
err = poll(pollFds, pollFdsCount, 0); // This is running for 14ms
if (err) {
break;
}
svcSleepThread(1000);
}
svcSleepThread(1000);
return err;
}
else {
return poll(pollFds, pollFdsCount, timeoutMs);
}
return err;
#else
return poll(pollFds, pollFdsCount, timeoutMs);
#endif