Hi Ryan! For the single-threaded non-blocking server in Guile, you have to make sure at least 3 steps: 1. set socket to non-blocking 2. enable suspended ports to prepare delimited-continuation powered coroutine 3. designed your own scheduler Even in the single thread, you can handle requests concurrently because of the coroutine based on delimited-continuation. Of course you may enhance it with thread pool. Best regards. On Mon, Mar 25, 2024 at 4:04 AM Ryan Raymond wrote: > Hello, all. > I was able to build a non-blocking web-server using network sockets. > However, the existing guile web/server.scm implementation is > single-threaded and therefore blocking, which is sub-optimal for some > use-cases. > > I suggest we slightly modify the server logic to have an optional > #:blocking? [bool] parameter which would enable behavior in line with the > following excerpt from my own code. Obviously some changes would be made to > methodology and code style, but you get the picture. > > (define (listen sock) > (let* ( > (client-connection (accept sock)) > (client-details (cdr client-connection)) > (client (car client-connection))) > (begin-thread > (sigaction SIGPIPE SIG_IGN) > (handle client) > (close client)) > )) > > This shouldn't cause any backwards-compatibility issues since it's > optional, but the specifics of web/server.scm might cause problems. > Let me know what you think! > Ryan >