Further improvements to CPU platform

Further optimizations.  Also created a ThreadPool class to simplify code and allow sharing the same worker threads between multiple routines.