Discussion:
[asio-users] Coroutines spawn and resolver
Joseph Southwell
8 years ago
Permalink
So, I am having a weird problem.
This is visual studio 2017, ASIO 1.11 latest from git, I am also using boost 1.64, though I am not using boost's ASIO implementation.

When I use resolver in my first spawned coroutine no further spawned coroutines will ever get started. Simplest example I could workout is attached. There is #define USE_RESOLVER at the top, If you comment it out it will use a defined endpoint and that works fine. I am seeing resolver_op fire after the first coroutine completes (after the resolver has been destructed) and before the second one is dispatched to the strand and the second one never actually runs. I think this is a race condition with the resolver thread but I am having trouble tracking it down.
Joseph Southwell
8 years ago
Permalink
It appears to be a problem with the outstanding_work_ counter in win_iocp_io_context. When I use resolver it is calling stop on the io_context from win_iocp_io_context::work_finished_on_block_exit even though I have an io_service::work object instantiated for the io_service. When I don’t use resolver it doesn’t call the io_context stop function until I destroy the work object.
...
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
asio-users mailing list
asio-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIs

Loading...