Making ThreadPoolTest more robust to threading issues

Change-Id: I106014585a853d190023f4fcb5afa75c18195689