天之彼方
Results
1
issues of
天之彼方
在运行muduo/muduo/net/tests/EventLoopThreadPool_unittest.cc时发现EventLoopThreadPool::start对于3个EventLoopThread的情况存在一些时序上的问题,我列在了这里https://github.com/chenshuo/muduo/issues/441。 其原因我认为是EventLoopThreadPoll::startLoop里面的EventLoopThread::threadFunc还没执行到EventLoop::loop,就发生了EventLoopThreadPoll的析构,此时EventLoop::quit发生在EventLoop::loop之前,本应该退出的线程的EventLoop::quit_标志位被EventLoop::loop清除(此处你也标注了FIXME),我认为EventLoopThread::threadFunc中启动EventLoop完成的标志应该是EventLoop::loop开始运行,而不是loop_ = &loop; 因此,将cond_.notify();调整到了EventLoop正式开始后才确认EventLoopThread::startLoop操作正式完成,以此修正这个时序问题。