| 231 | } |
| 232 | |
| 233 | void ReactorThread::Shutdown(Messenger::ShutdownMode mode) { |
| 234 | CHECK(reactor_->closing()) << "Should be called after setting closing_ flag"; |
| 235 | |
| 236 | VLOG(1) << name() << ": shutting down Reactor thread."; |
| 237 | WakeThread(); |
| 238 | |
| 239 | if (mode == Messenger::ShutdownMode::SYNC) { |
| 240 | // Join() will return a bad status if asked to join on the currently |
| 241 | // running thread. |
| 242 | CHECK_OK(ThreadJoiner(thread_.get()).Join()); |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | void ReactorThread::ShutdownInternal() { |
| 247 | DCHECK(IsCurrentThread()); |