Stiffstream / sobjectizer

An implementation of Actor, Publish-Subscribe, and CSP models in one rather small C++ framework. With performance, quality, and stability proved by years in the production.

Home Page:https://stiffstream.com/en/products/sobjectizer.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should agent_t::so_drop_subscription* methods be marked as noexcept?

eao197 opened this issue · comments

commented

Methods like so_5::agent_t::so_drop_subscription do not throw exceptions if there is no subscription to be removed.
But these methods do not marked as noexcept. Why?

If this is a historical coincidente then it has to be fixed and these method should be declared as noexcept to make clear that they can be used safely in destructors and catch blocks.

If this is intended then we has to review implementation and try to make them truly noexcept.

commented

The so_5::agent_t::so_drop_subscription* methods can't be marked as noexcept, because there is a check that a method is called on the agent's worker thread:

ensure_operation_is_on_working_thread( "do_drop_subscription" );

This check throws if this is not the case.

But if so_drop_subscription* is called from the right thread then drop subscription operation can't throw:

virtual void
drop_subscription(
const mbox_t & mbox,
const std::type_index & msg_type,
const state_t & target_state ) noexcept = 0;
virtual void
drop_subscription_for_all_states(
const mbox_t & mbox,
const std::type_index & msg_type ) noexcept = 0;