Handle async events. These events are sent to the reactor by other threads that want to bring something to our attention, like the fact that we're shutting down, or the fact that there is a new outbound Transfer ready to send.
| 325 | // we're shutting down, or the fact that there is a new outbound Transfer |
| 326 | // ready to send. |
| 327 | void ReactorThread::AsyncHandler(ev::async& /*watcher*/, int /*revents*/) { |
| 328 | DCHECK(IsCurrentThread()); |
| 329 | |
| 330 | if (PREDICT_FALSE(reactor_->closing())) { |
| 331 | ShutdownInternal(); |
| 332 | loop_.break_loop(); // break the epoll loop and terminate the thread |
| 333 | return; |
| 334 | } |
| 335 | |
| 336 | boost::intrusive::list<ReactorTask> tasks; |
| 337 | reactor_->DrainTaskQueue(&tasks); |
| 338 | |
| 339 | while (!tasks.empty()) { |
| 340 | ReactorTask& task = tasks.front(); |
| 341 | tasks.pop_front(); |
| 342 | task.Run(this); |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | void ReactorThread::RegisterConnection(scoped_refptr<Connection> conn) { |
| 347 | DCHECK(IsCurrentThread()); |
nothing calls this directly
no test coverage detected