Discussion:
[asio-users] How to wait for completion of all stackful coroutines?
Nikita Chumakov
2014-10-21 09:52:06 UTC
Permalink
Hi,

I'm starting a number of coroutines with asio::spawn, and I want to wait
until all of then are finished and do some other work then. How it can
be done?

The control flow is following:

asio::spawn (io, [] (asio::yield_context yield) {
...
// starting few coroutines
asio::spawn (yield, [] (asio::yield_context yield2) { ... });
asio::spawn (yield, [] (asio::yield_context yield2) { ... });
asio::spawn (yield, [] (asio::yield_context yield2) { ... });
asio::spawn (yield, [] (asio::yield_context yield2) { ... });

// now I want to wait for all of them to finish before I do
// some other work?
...
});

io.run ();

Regards,
Nikki


------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
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/WhoIsUsingAsio

Loading...