Handling iterables in a safe way when using thread based prefetching