Simple thread pool implementation.