mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
Event loop: what is due called when waiting fails; units on Windows
looponce() called nothing due when waiting for the sockets failed, returning at once: a caller waiting for a timer turned forever. What is due is called all the same, and on Windows WSAEINTR is no failure, not errno. looptest reports any failure to wait with its error; fibertest starts Winsock, its loop could not be made without, and recurses into half of a fiber's stack rather than most of it, which Windows takes more of. The units case shows what a test which never finished wrote. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4e1455b419
commit
30f6043160
4 files changed
+54
-17
No files matched your search
+8
-2
@@ -660,7 +660,13 @@ int looponce(struct loop *l, int maxwait){
|
||||
if(l->pfds[j].revents) readyadd(l, l->pios[j], l->pfds[j].revents);
|
||||
}
|
||||
#endif
|
||||
if(n < 0 && errno != EINTR) return -1;
|
||||
/* failing, what is due is still called: the caller decides whether to
|
||||
go on */
|
||||
#ifdef _WIN32
|
||||
if(n < 0 && WSAGetLastError() == WSAEINTR) n = 0;
|
||||
#else
|
||||
if(n < 0 && errno == EINTR) n = 0;
|
||||
#endif
|
||||
l->now = l->clock();
|
||||
if(woken){
|
||||
wakedrain(l);
|
||||
@@ -671,7 +677,7 @@ int looponce(struct loop *l, int maxwait){
|
||||
|
||||
if(io) io->func(l, io, l->readyev[i]);
|
||||
}
|
||||
n = l->nready;
|
||||
if(n >= 0) n = l->nready;
|
||||
l->nready = 0;
|
||||
timersturn(l);
|
||||
timersfire(l);
|
||||
|
||||
Reference in new issue
Block a user