Prevent concurrent modification of ThreadPool.threads