| 936 | } |
| 937 | |
| 938 | void Reactor::ScheduleReactorTask(ReactorTask* task) { |
| 939 | bool was_empty; |
| 940 | { |
| 941 | std::unique_lock<LockType> l(lock_); |
| 942 | if (closing_) { |
| 943 | // We guarantee the reactor lock is not taken when calling Abort(). |
| 944 | l.unlock(); |
| 945 | task->Abort(ShutdownError(false)); |
| 946 | return; |
| 947 | } |
| 948 | was_empty = pending_tasks_.empty(); |
| 949 | pending_tasks_.push_back(*task); |
| 950 | } |
| 951 | if (was_empty) { |
| 952 | thread_.WakeThread(); |
| 953 | } |
| 954 | } |
| 955 | |
| 956 | bool Reactor::DrainTaskQueue(boost::intrusive::list<ReactorTask>* tasks) { // NOLINT(*) |
| 957 | std::lock_guard<LockType> l(lock_); |
no test coverage detected