boost::asio::deadline_timer cancel and expires_from_now

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

boost::asio::deadline_timer cancel and expires_from_now

Boost - Users mailing list
Hi,

Is it necessary to call the timer.cancel() before timer.expires_from_now? I think it is not just unnecessary, it will be a bug to call the timer.cancel() before timer.expires_from_now, I think that will run the cancel if the previous timer is not expired, is it correct?

Thank you

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: boost::asio::deadline_timer cancel and expires_from_now

Boost - Users mailing list
Hi!

The documentation stands that any pending operations will be cancelled, just like calling timer.cancel().

Have in mind that the handler for the cancelled operation will be called with error_code set to boost::asio::error::operation_aborted.

Best regards
Juan


On Mon, May 8, 2017 at 8:43 PM, jupiter via Boost-users <[hidden email]> wrote:
Hi,

Is it necessary to call the timer.cancel() before timer.expires_from_now? I think it is not just unnecessary, it will be a bug to call the timer.cancel() before timer.expires_from_now, I think that will run the cancel if the previous timer is not expired, is it correct?

Thank you

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users



--
Juan
:wq


_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: boost::asio::deadline_timer cancel and expires_from_now

Boost - Users mailing list
Thanks Juan for the confirmation.



On Tue, May 9, 2017 at 12:02 PM, Juan Ramírez <[hidden email]> wrote:
Hi!

The documentation stands that any pending operations will be cancelled, just like calling timer.cancel().

Have in mind that the handler for the cancelled operation will be called with error_code set to boost::asio::error::operation_aborted.

Best regards
Juan


On Mon, May 8, 2017 at 8:43 PM, jupiter via Boost-users <[hidden email]> wrote:
Hi,

Is it necessary to call the timer.cancel() before timer.expires_from_now? I think it is not just unnecessary, it will be a bug to call the timer.cancel() before timer.expires_from_now, I think that will run the cancel if the previous timer is not expired, is it correct?

Thank you

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users



--
Juan
:wq



_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users