O'Reilly logo

Boost.Asio C++ Network Programming by John Torjo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Co-routines

The author of Boost.Asio, around 2009-2010, implemented a very cool concept, co-routines, to help you design asynchronous applications even easier.

They allow you to have the best of both worlds, that is, write asynchronous applications and easily follow the flow of control, almost as if the application was written sequentially.

Co-routines

The normal flow is shown in case 1. Using co-routines, you'll get as close to case two as possible.

Simply put, a co-routine allows multiple entry points for suspending and resuming execution at certain locations within a function.

If you are to use co-routines, you'll need two header files that are only found ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required