pitrou commented on code in PR #45954:
URL: https://github.com/apache/arrow/pull/45954#discussion_r2017087658
##########
cpp/src/arrow/util/async_generator.h:
##########
@@ -800,16 +816,18 @@ class ReadaheadGenerator {
: source_generator(std::move(source_generator)),
max_readahead(max_readahead) {}
void MarkFinishedIfDone(const T& next_result) {
+ // ASSERT_HELD(mu)
if (IsIterationEnd(next_result)) {
- finished.store(true);
+ finished = true;
}
}
AsyncGenerator<T> source_generator;
int max_readahead;
Future<> final_future = Future<>::Make();
- std::atomic<int> num_running{0};
- std::atomic<bool> finished{false};
+ int num_running{0}; // GUARDED_BY(mu)
Review Comment:
Is `GUARDED_BY` an annotation for some kind of static analysis tool? Which
one?
##########
cpp/src/arrow/util/async_generator.h:
##########
@@ -800,16 +816,18 @@ class ReadaheadGenerator {
: source_generator(std::move(source_generator)),
max_readahead(max_readahead) {}
void MarkFinishedIfDone(const T& next_result) {
+ // ASSERT_HELD(mu)
if (IsIterationEnd(next_result)) {
- finished.store(true);
+ finished = true;
}
}
AsyncGenerator<T> source_generator;
int max_readahead;
Future<> final_future = Future<>::Make();
- std::atomic<int> num_running{0};
- std::atomic<bool> finished{false};
+ int num_running{0}; // GUARDED_BY(mu)
+ bool finished{false}; // GUARDED_BY(mu)
+ arrow::util::Mutex mu;
Review Comment:
Please call this `mutex`.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]