Discussion:
Coroutines spawn and resolver
(too old to reply)
Joseph Southwell
2017-06-19 21:26:49 UTC
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
2017-06-20 19:36:54 UTC
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.
Post by Joseph Southwell
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.
<spawnresolver.cpp>------------------------------------------------------------------------------
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
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio
------------------------------------------------------------------------------
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...