| 31 | } |
| 32 | |
| 33 | void EventLoopThreadPool::start(const ThreadInitCallback& cb) |
| 34 | { |
| 35 | assert(!started_); |
| 36 | baseLoop_->assertInLoopThread(); |
| 37 | |
| 38 | started_ = true; |
| 39 | |
| 40 | for (int i = 0; i < numThreads_; ++i) |
| 41 | { |
| 42 | char buf[name_.size() + 32]; |
| 43 | snprintf(buf, sizeof buf, "%s%d", name_.c_str(), i); |
| 44 | EventLoopThread* t = new EventLoopThread(cb, buf); |
| 45 | threads_.push_back(std::unique_ptr<EventLoopThread>(t)); |
| 46 | loops_.push_back(t->startLoop()); |
| 47 | } |
| 48 | if (numThreads_ == 0 && cb) |
| 49 | { |
| 50 | cb(baseLoop_); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | EventLoop* EventLoopThreadPool::getNextLoop() |
| 55 | { |
nothing calls this directly
no test coverage detected