Fix for unit test failure when threads are created too slowly.