westonpace commented on a change in pull request #10061:
URL: https://github.com/apache/arrow/pull/10061#discussion_r616022528
##########
File path: cpp/src/arrow/util/async_generator.h
##########
@@ -1489,17 +1522,23 @@ class GeneratorIterator {
/// \brief Converts an AsyncGenerator<T> to an Iterator<T> by blocking until
each future
/// is finished
+///
+/// If this underlying generator transfers to the CPU pool then this blocking
call will be
+/// considered "nested parallelism" and is not safe to call from a CPU pool
thread.
+///
+/// To avoid this you can use MakeGeneratorIterator
template <typename T>
-Result<Iterator<T>> MakeGeneratorIterator(AsyncGenerator<T> source) {
- return Iterator<T>(GeneratorIterator<T>(std::move(source)));
+Result<Iterator<T>> MakeSimpleGeneratorIterator(AsyncGenerator<T> source) {
+ return Iterator<T>(SimpleGeneratorIterator<T>(std::move(source)));
}
/// \brief Adds readahead to an iterator using a background thread.
///
/// Under the hood this is converting the iterator to a generator using
/// MakeBackgroundGenerator, adding readahead to the converted generator with
/// MakeReadaheadGenerator, and then converting back to an iterator using
-/// MakeGeneratorIterator.
+/// MakeSimpleGeneratorIterator (this is safe because we the generator never
Review comment:
N/A, code removed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]