Search code examples
c++network-programmingboosttimerasio

When does Asio's timer throws while canceling?


Boost Asio's steady_timer::cancel() may throw a boost::system::system_error.

Under what circumstances can this happen?

https://www.boost.org/doc/libs/1_67_0/doc/html/boost_asio/reference/basic_waitable_timer/cancel/overload1.html


The current Networking TS has a basic_waitable_timer with a not noexcept .cancel() function. Has the noexcept been forgotten here or can the function also throw exceptions?

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/n4734.pdf [timer.waitable.ops]


Solution

  • Under what circumstances can this happen?

    I can't think of any. Note that the overload taking an error_code reference has been deprecated: (Deprecated: Use non-error_code overload.)

    This tells me the error interface was excess.