templatize thread pool