| 149 | class WithSignalHandlerContext { |
| 150 | public: |
| 151 | WithSignalHandlerContext() : signal_handler_registered_(false) { |
| 152 | if (MainRThread::GetInstance().SignalStopSourceEnabled()) { |
| 153 | arrow::Status result = arrow::RegisterCancellingSignalHandler({SIGINT}); |
| 154 | |
| 155 | // If this result was not OK we don't get cancellation for the |
| 156 | // lifecycle of this object; however, we can still carry on. This |
| 157 | // can occur when forking the R process (e.g., using parallel::mclapply()). |
| 158 | if (result.ok()) { |
| 159 | signal_handler_registered_ = true; |
| 160 | } else { |
| 161 | result.Warn(); |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | ~WithSignalHandlerContext() { |
| 167 | if (signal_handler_registered_) { |
nothing calls this directly
no test coverage detected