When using etl::send_message on a router, the call to on_receive goes through virtual calls instead of being directly dispatched.
This is not occurring when the message is posted using etl::message_router::receive directly.
I verified this using the code from Message router example through Godbolt (link).
Using etl::send_message:
Using etl::message_router::receive:
Probably this is not a problem on itself, only that is not documented anywhere and the doc page states "The on_receive functions are not virtual" which can be misleading, considering that the send_message is also used in the examples.
etl::send_message could be refactored as a template function, thereby resolving to a direct call for a concrete message_router derived object, or a virtual call for a base reference.
When using
etl::send_message
on a router, the call toon_receive
goes through virtual calls instead of being directly dispatched. This is not occurring when the message is posted usingetl::message_router::receive
directly.I verified this using the code from Message router example through Godbolt (link).
Using![image](https://github.com/ETLCPP/etl/assets/1084583/b9f67b64-db02-497e-92cc-49be38dade49)
etl::send_message
:Using![image](https://github.com/ETLCPP/etl/assets/1084583/6cd855f5-6e71-4475-ad6c-2a787b8172a6)
etl::message_router::receive
:Probably this is not a problem on itself, only that is not documented anywhere and the doc page states "The on_receive functions are not virtual" which can be misleading, considering that the
send_message
is also used in the examples.