Given the following test program:
#include <asio.hpp> #include <cassert> int main() { asio::io_service ios1, ios2; asio::io_service::strand s2(ios2); auto test_func = wrap(s2, [&] { assert(s2.running_in_this_thread()); }); auto wrap_test_func = wrap(ios1, test_func); wrap_test_func(); ios1.run_one(); ios2.run_one(); }
I understand that this program should not be argued.
wrap_test_func enclosed in io_service ios1 . The function that it wraps is wrapped in strand s2 (which uses ios2 ).
As I understand it, calling wrap_test_func should be equivalent to dispatch(ios1, test_func) , which then should send lambda to s2 ).
However, it seems that the shell has deployed the inner shell.
Is this the expected behavior?
source share