-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Description
I think below might be a incorrect ordering:
Thread1: check state_->finished.load() == true in 1
Thread2: state->MarkFinishedIfDone, state->final_future.MarkFinished
Thread1: state_->num_running.fetch_add(1) in 2
Thread1: state->final_future.MarkFinished
auto result = std::move(state_->readahead_queue.front());
state_->readahead_queue.pop();
if (state_->finished.load()) { // 1
state_->readahead_queue.push(AsyncGeneratorEnd<T>());
} else {
state_->num_running.fetch_add(1); // 2
auto back_of_queue = state_->source_generator();
auto back_of_queue_after_check =
AddMarkFinishedContinuation(std::move(back_of_queue));
state_->readahead_queue.push(std::move(back_of_queue_after_check));
}
Originally posted by @mapleFU in #44990 (comment)