| 240 | } |
| 241 | |
| 242 | static void ReceiveSignals(std::shared_ptr<SelfPipe> self_pipe) { |
| 243 | // Wait for signals on the self-pipe and propagate them to the current StopSource |
| 244 | DCHECK(self_pipe); |
| 245 | while (true) { |
| 246 | auto maybe_payload = self_pipe->Wait(); |
| 247 | if (maybe_payload.status().IsInvalid()) { |
| 248 | // Pipe shut down |
| 249 | return; |
| 250 | } |
| 251 | if (!maybe_payload.ok()) { |
| 252 | maybe_payload.status().Warn(); |
| 253 | return; |
| 254 | } |
| 255 | const int signum = static_cast<int>(maybe_payload.ValueUnsafe()); |
| 256 | instance()->ReceiveSignal(signum); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | void ReceiveSignal(int signum) { |
| 261 | std::lock_guard<std::mutex> lock(mutex_); |
nothing calls this directly
no test coverage detected