Have anyone encounter that the deadline_timer call the next callback function with 10 millisecond later constantly? Is it expected?
The OS is centos 6 and boost version is 1.54.
e.g.
Aug 14 16:36:01.697
Aug 14 16:36:02.706
Aug 14 16:36:03.716
Aug 14 16:36:04.726
Aug 14 16:36:05.736
Aug 14 16:36:06.746
Aug 14 16:36:07.756
Aug 14 16:36:08.766
Aug 14 16:36:09.776
Aug 14 16:36:10.786
Aug 14 16:36:11.796
Aug 14 16:36:12.806
Aug 14 16:36:13.816
Aug 14 16:36:14.826
Aug 14 16:36:15.836
Aug 14 16:36:16.846
Aug 14 16:36:17.856
the code looks like below
// std::unique_ptr<boost::asio::deadline_timer> m_poTimer;
void timerExpired(const boost::system::error_code& oError)
{
if (!oError)
{
m_poTimer->expires_from_now(boost::posix_time::millisec(1000));
m_poTimer->async_wait(std::bind(&timerExpired, this, std::placeholders::_1));
}
else
{
}
}
See Question&Answers more detail:os