Closed ehds closed 2 years ago
Ubuntu 21.04 x86_64
cpp11 muduo version: 90920bbad80e544da9a8a94b16ad8ab4bb66e652
cmake version 3.22.1 gcc version 10.3.0
In TimerQueue::handleRead, cancelingTimers_ will be cleared before reset. https://github.com/chenshuo/muduo/blob/90920bbad80e544da9a8a94b16ad8ab4bb66e652/muduo/net/TimerQueue.cc#L172 Then reset will use cancelingTimers_ again to find canceled timers. https://github.com/chenshuo/muduo/blob/90920bbad80e544da9a8a94b16ad8ab4bb66e652/muduo/net/TimerQueue.cc#L212 But TimerQueue::handleRead always happened before TimerQueue::reset and in the same loop thread. It seems that cancelingTimers_ is useless. I have no idea what's the purpose of cancelingTimers_.
TimerQueue::handleRead
cancelingTimers_
reset
TimerQueue::reset
Timer callback maybe cancel timer.
Linux distro and version? x86 or ARM? 32-bit or 64-bit?
Ubuntu 21.04 x86_64
Branch (cpp98/cpp11/cpp17) and version of muduo?
cpp11 muduo version: 90920bbad80e544da9a8a94b16ad8ab4bb66e652
Version of cmake, gcc and boost? (If not from distro.)
cmake version 3.22.1 gcc version 10.3.0
In
TimerQueue::handleRead
,cancelingTimers_
will be cleared beforereset
. https://github.com/chenshuo/muduo/blob/90920bbad80e544da9a8a94b16ad8ab4bb66e652/muduo/net/TimerQueue.cc#L172 Thenreset
will usecancelingTimers_
again to find canceled timers. https://github.com/chenshuo/muduo/blob/90920bbad80e544da9a8a94b16ad8ab4bb66e652/muduo/net/TimerQueue.cc#L212 ButTimerQueue::handleRead
always happened beforeTimerQueue::reset
and in the same loop thread. It seems thatcancelingTimers_
is useless. I have no idea what's the purpose ofcancelingTimers_
.