Hi<br><br>Is this a bug, or am I doing something wrong?<br><br>#include &lt;iostream&gt;<br>#include &lt;boost/asio.hpp&gt;<br>#include &lt;boost/bind.hpp&gt;<br><br>using namespace std;<br>using namespace boost::asio;<br>
<br>struct A {<br>    A(io_service &amp; service) : timer1(service), timer2(service) {<br>        timer1.expires_from_now( boost::posix_time::seconds(5) );<br>        timer1.async_wait(boost::bind(&amp;A::handler, this, _1));<br>
<br>        timer2.expires_from_now( boost::posix_time::seconds(2) );<br>        timer2.async_wait(boost::bind(&amp;A::interrupt, this, _1));<br>    }<br><br>    void handler(const boost::system::error_code &amp;ec) {<br>
        cout &lt;&lt; &quot;Forbidden handler&quot; &lt;&lt; endl;<br>        assert(0);<br>    }<br><br>    void handler_interrupted(const boost::system::error_code &amp;ec) {<br>        cout &lt;&lt; &quot;Hello world&quot; &lt;&lt; endl;<br>
    }<br><br>    void interrupt(const boost::system::error_code &amp;ec) {<br>        cout &lt;&lt; &quot;Interrupted&quot; &lt;&lt; endl;<br>        int res = timer1.cancel();<br>        assert(res &gt; 0);<br><br>        timer1.expires_from_now( boost::posix_time::milliseconds(0) );<br>
        timer1.async_wait(boost::bind(&amp;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>