MCPcopy Create free account
hub / github.com/chenshuo/muduo / start

Method start

muduo/net/EventLoopThreadPool.cc:33–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33void 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
54EventLoop* EventLoopThreadPool::getNextLoop()
55{

Callers

nothing calls this directly

Calls 4

c_strMethod · 0.80
startLoopMethod · 0.80
assertInLoopThreadMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected