cleanup and implement a very simple thread pool