Refactored common thread pool functionality into a common base class.