How can I write a Lua thread pool?