| 31 | } |
| 32 | |
| 33 | std::shared_ptr<TaskScheduler> EventLoop::GetTaskScheduler() |
| 34 | { |
| 35 | std::lock_guard<std::mutex> locker(mutex_); |
| 36 | if (task_schedulers_.size() == 1) { |
| 37 | return task_schedulers_.at(0); |
| 38 | } |
| 39 | else { |
| 40 | auto task_scheduler = task_schedulers_.at(index_); |
| 41 | index_++; |
| 42 | if (index_ >= task_schedulers_.size()) { |
| 43 | index_ = 1; |
| 44 | } |
| 45 | return task_scheduler; |
| 46 | } |
| 47 | |
| 48 | return nullptr; |
| 49 | } |
| 50 | |
| 51 | void EventLoop::Loop() |
| 52 | { |