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

   > No. Thread1 is the "main execute ReadaheadGenerator::operator()() thread", 
and thread2 is triggered by sub-task
   
   Oh, indeed. My previous understanding was wrong. Sorry :(
   
   > An `std::atomic<int64_t>` with CAS would works in this scenerio, I just 
use a lock-based impl to verify it fixes this problem.
   
   > I would say a lock is entirely fine, if it's only protecting a small 
region that does not invoke third-party code.
   
   Ah, yes this locking is alright. I was originally understanding it as 
locking to synchronize concurrent calls to `operator()()`. By looking again it 
is actually synchronizing between `operator()()` and the future continuations, 
which is still async-reentrant. I should've look more carefully. Sorry :(


-- 
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