Hi!

Andy Wingo <wi...@pobox.com> skribis:

> The web server is single-threaded and uses blocking IO (though it does
> poll(2) for keepalive).  As such, any slow writer or slow reader can
> block the process.  Using non-blocking I/O is too difficult, for now.
> So, threads.
>
> I'd like to create a pool of threads for I/O.  Some threads would pop
> ports off of the "to-read" queue, read request headers and bodies, then
> push the requests onto a "to-process" queue.  Something (currently the
> main thread) would process requests, and push them onto the "to-write"
> queue.  IO threads would pop data (or closures) off of the to-write
> queue, and write them to clients, possibly pushing the ports back on a
> "to-keepalive" queue, which the poll loop would notice and add those fds
> back to the poll set.

OK, I see.

> I'd also like to consider creating a separate pool of threads for
> computation.  Obviously the size of these thread pools would be
> different.  We could use futures for that, I suppose, but I'd like to
> also be able to stop those threads, forcefully if needed, when the web
> server stops.

What do you think of adding a ‘cancel’ primitive to futures?

Thanks,
Ludo’.

Reply via email to