| 121 | } |
| 122 | |
| 123 | static void WaitForSignals(std::shared_ptr<SelfPipe> self_pipe) { |
| 124 | // Wait for a signal handler to wake up the pipe |
| 125 | auto st = self_pipe->Wait().status(); |
| 126 | // Status::Invalid means the pipe was shutdown without any wakeup |
| 127 | if (!st.ok() && !st.IsInvalid()) { |
| 128 | ARROW_LOG(FATAL) << "Failed to wait on self-pipe: " << st.ToString(); |
| 129 | } |
| 130 | auto instance = running_instance_.load(); |
| 131 | if (instance != nullptr) { |
| 132 | ARROW_WARN_NOT_OK(instance->transport_->Shutdown(), "Error shutting down server"); |
| 133 | } |
| 134 | } |
| 135 | }; |
| 136 | |
| 137 | std::atomic<FlightServerBase::Impl*> FlightServerBase::Impl::running_instance_; |