Hi

Is this a bug, or am I doing something wrong?

#include <iostream>
#include <boost/asio.hpp>
#include <boost/bind.hpp>

using namespace std;
using namespace boost::asio;

struct A {
    A(io_service & service) : timer1(service), timer2(service) {
        timer1.expires_from_now( boost::posix_time::seconds(5) );
        timer1.async_wait(boost::bind(&A::handler, this, _1));

        timer2.expires_from_now( boost::posix_time::seconds(2) );
        timer2.async_wait(boost::bind(&A::interrupt, this, _1));
    }

    void handler(const boost::system::error_code &ec) {
        cout << "Forbidden handler" << endl;
        assert(0);
    }

    void handler_interrupted(const boost::system::error_code &ec) {
        cout << "Hello world" << endl;
    }

    void interrupt(const boost::system::error_code &ec) {
        cout << "Interrupted" << endl;
        int res = timer1.cancel();
        assert(res > 0);

        timer1.expires_from_now( boost::posix_time::milliseconds(0) );
        timer1.async_wait(boost::bind(&A::handler_interrupted, this, _1));
    }

    int count, max, timeout1, timeout2;
    deadline_timer timer1;
    deadline_timer timer2;
};

int main() {
    io_service service;
    A a(service);
    service.run();

    return 0;
}