in reply to Building a thread pool

It is is not exactly the same but Net::Server::PreFork and Net::Server::PreForkSimple will fork a set of child processes, wait for a network connection, and issue requests to the child processes.

If these do not do what you need maybe the source code will help.

These modules maintain a range (minimum and maximum) of child processes ready to serve requests. Each child processes are killed and respawn after it processes a set number of requests.