a stop hack for embedded httpd threads on windows

This commit is contained in:
Adam D. Ruppe 2023-03-09 21:49:45 -05:00
parent db612a4c47
commit 680003ae87
1 changed files with 19 additions and 2 deletions

21
cgi.d
View File

@ -5521,8 +5521,25 @@ class ListeningConnectionManager {
return listener.accept(); return listener.accept();
return null; return null;
} else } else {
return listener.accept(); // FIXME: check the cancel flag!
Socket socket = listener;
auto check = new SocketSet();
keep_looping:
check.reset();
check.add(socket);
// just to check the stop flag on a kinda busy loop. i hate this FIXME
auto got = Socket.select(check, null, null, 3.seconds);
if(got > 0)
return listener.accept();
if(globalStopFlag)
return null;
else
goto keep_looping;
}
} }
int defaultNumberOfThreads() { int defaultNumberOfThreads() {