Hi<br><br>Is this a bug, or am I doing something wrong?<br><br>#include <iostream><br>#include <boost/asio.hpp><br>#include <boost/bind.hpp><br><br>using namespace std;<br>using namespace boost::asio;<br> <br>struct A {<br> A(io_service & service) : timer1(service), timer2(service) {<br> timer1.expires_from_now( boost::posix_time::seconds(5) );<br> timer1.async_wait(boost::bind(&A::handler, this, _1));<br> <br> timer2.expires_from_now( boost::posix_time::seconds(2) );<br> timer2.async_wait(boost::bind(&A::interrupt, this, _1));<br> }<br><br> void handler(const boost::system::error_code &ec) {<br> cout << "Forbidden handler" << endl;<br> assert(0);<br> }<br><br> void handler_interrupted(const boost::system::error_code &ec) {<br> cout << "Hello world" << endl;<br> }<br><br> void interrupt(const boost::system::error_code &ec) {<br> cout << "Interrupted" << endl;<br> int res = timer1.cancel();<br> assert(res > 0);<br><br> timer1.expires_from_now( boost::posix_time::milliseconds(0) );<br> timer1.async_wait(boost::bind(&A::handler_interrupted, this, _1));<br> }<br><br> int count, max, timeout1, timeout2;<br> deadline_timer timer1;<br> deadline_timer timer2;<br>};<br><br>int main() {<br> io_service service;<br> A a(service);<br> service.run();<br><br> return 0;<br>}<br><br><br>