MCPcopy Create free account
hub / github.com/Shangyizhou/A-Tiny-Network-Library / startLoop

Method startLoop

src/net/EventLoopThread.cc:32–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32EventLoop* EventLoopThread::startLoop()
33{
34 // 调用startLoop即开启一个新线程
35 thread_.start();
36
37 EventLoop *loop = nullptr;
38 {
39 // 等待新线程执行threadFunc完毕,所以使用cond_.wait
40 std::unique_lock<std::mutex> lock(mutex_);
41 while (loop_ == nullptr)
42 {
43 cond_.wait(lock);
44 }
45 loop = loop_;
46 }
47 return loop;
48}
49
50void EventLoopThread::threadFunc()
51{

Callers 1

startMethod · 0.80

Calls 1

startMethod · 0.45

Tested by

no test coverage detected