This release features completely rewritten threading code.
Instead of having the awfull mess between RequestDispatcher
and RequestHandler, each keeping track of locks, connections,
threads, etc. separately, we now have nicely separated Queue
class, that deals with thread pooling and task distribution.
Task in this case is single client connection, which gets
accepted by dispatcher, wrapped into RequestHandler
object, and queued into the pool for processing.
As a result threading code is lot cleaner, and
dispatching/request handling code became very
small and simple.
Also, for now thread-pool size is fixed. Perhaps it would
make sense to make it configurable option, or, more
likely startup parameter. One of the reasons, is that
stopping threads cleanly is PITA, and I didn't find
any way to make it nice.
To be more specific, stopping POSIX thread does not
let me unroll the stack propperly. Thus, if I interrupt a thread
running servlet->service funtion, none of the on-stack objects
will be destroyed.
Still something to ponder for a while.