paleolimbot commented on PR #13635:
URL: https://github.com/apache/arrow/pull/13635#issuecomment-1191420336

   I appreciate your patience with anything I said earlier...the degree to 
which I misunderstood this API is difficult to describe (in particular, I 
didn't get that a new `StopToken` had to get passed to each cancellable 
operation). I'm happy to say it works! I *would* prefer to be able to subclass 
a `StopToken` and provide an R-specific implementation, but that's a separate 
discussion.
   
   I had to use the `StopSource::Reset()` method that is marked internal (or 
else cancelling one thing results in many subsequent operations marked as 
cancelled). I initially worked around that by using R's equivalent of a context 
manager to set and reset the stop source pointer, but that's difficult to 
program around for us because what does and does not go within 
`with_stop_source(some_code)` we can't always control.
   
   I asked in the r-lib channel about the safety of overriding signal handlers 
and they seemed to indicate that doing it temporarily is OK as long as the R 
API isn't called. Hence, I only enable the signal handlers when we're about to 
launch a worker thread to do "arrow stuff" and disable the signal handlers when 
`SafeCallIntoR()` is invoked. This is the part that I'm worried will break.


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

Reply via email to