mapleFU commented on PR #44990:
URL: https://github.com/apache/arrow/pull/44990#issuecomment-2757036416

   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));
       }
   ```


-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to