Closed dbr closed 5 years ago
I've had the same need for a server, and was about to make the same PR. It seems like the simplest and cleanest solution to being able to shut down the server from the same thread. For the moment, I did the same delay-based solution, but it's a needless waste, as the main reason for using rouille is the fact that it's so snappy and lightweight!!
As per #200 I was looking for a way to have Rouille run in a thread, in a way which I could interrupt when the application shutdown.
Just calling
poll
in a loop seemed very wasteful. For my purposes just callingpoll
with a short (~10ms or so) sleep was okay, but seemed like it'd be easy/useful to add apoll_timeout
method consistent with tiny_http'srecv_timeout