Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost asio deadline_timer, bug?
From: Arash Partow (arash_at_[hidden])
Date: 2011-08-19 04:33:03


Allan Nielsen wrote:
> Is this a bug, or am I doing something wrong?
>
>

No bug here (I think), as per [1], a cancelled operation will be invoked
with an error code - this is so one can discern between a normal
invocation and a cancel or error.

Your handler could be updated like so:

void handler(const boost::system::error_code &ec)
{
    if (!ec)
    {
       cout << "Forbidden handler" << endl;
       assert(0);
    }
    else
       cout << "Timer1 interrupted by someone." << endl;
}

1:
http://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/reference/basic_deadline_timer/cancel/overload1.html


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net