My latest column for MSDN Magazine is now available online as well as in print.
I necessarily began this series of articles exploring alternative techniques for achieving concurrency with a practical solution because the reality is that we need solutions that work today. We do, however, need to look to the future and push the C++ community forward by demanding greater support for writing I/O-intensive applications in a more natural and productive manner. Surely writing highly scalable systems shouldn’t be the exclusive purview of JavaScript and C# programmers and the rare C++ programmer with enough willpower.
This is the last of three articles where I explore alternative techniques for achieving concurrency in C++. Thanks again to Artur Laksberg from the Visual C++ team for reviewing the drafts and providing valuable feedback.
Here is the complete series:
- Lightweight Cooperative Multitasking with C++
- The Pursuit of Efficient and Composable Asynchronous Systems
- Back to the Future with Resumable Functions
You can find links to more of my articles here.
Coroutines are so much fun. I use them in the Paint.NET installer via the C# iterator feature (“yield return”). It let’s me write my “install script” as a logically sequential block of code which is able to jump back and forth between the UI thread and a background thread by way of emitting directives to a scheduler (“yield return new SwitchToThreadDirective(…)”). This way I can hop to the UI thread, turn on the progress bar, then hop back to the background thread and do a blocking call to something expensive or time consuming, etc.
Neat! Having experimented with coroutines now in C, C# and C++ I cannot imagine why it’s taken so long for this idea to take hold.