View analytic
Friday, September 29 • 9:00am - 10:00am
Eight Ways to Handle Non-blocking Returns in Message-passing Programs: from C++98 via C++11 to C++20

Log in to save this to your schedule and see who's attending!

Shared-Nothing approach of "sharing memory by communicating" (instead of "communicating by sharing memory") gets more and more traction in the development world; this is not to mention that message-passing Shared-Nothing architectures have always been a cornerstone of both game development and UI development. These days, more and more projects realize the inherent dangers of combining business logic and thread sync within the same piece of code - which leads to cognitive overload (pushing developers well over 7+-2 boundary) and results in poor developer productivity, poor program reliability, and very often - subpar performance. In addition, message-passing programs allow to achieve determinism easily, which in turn provides very significant benefits, including such beauties as production post-mortem analysis, replay-based regression testing, and low-latency fault tolerance.

Within the realm of message-passing programs, the problem of processing non-void returns from non-blocking calls is a particularly ugly one. Over time, approaches to solving it have progressed from simple message-sending to OO-based callbacks, and further to the lambda pyramids and futures. Still, programming non-blocking calls is a Big Headache(tm). In this talk, we'll discuss _eight_ different ways of handling returns from non-blocking calls in the context of message-passing architectures (using event-driven architectures as an all-popular example of message-passing). We'll start with a simplistic message exchange, and will progress to void RPCs, OO-style callbacks, lambda pyramids, single-threaded futures, lambda-based "code builder", coroutines/fibers, and (currently MSVC-only) async/await.

Last but not least, we'll try to discuss three current C++ standard proposals which may help us to solve the problem, and will try to make a compelling case for Resumable Functions. We'll try to demonstrate that there _exist_ real-world use cases where Resumable Functions are substantially better than both Resumable Expressions and coroutines - and this should be sufficient to provide a strong argument for including Resumable Functions into the next C++ standard. In particular, we'll try to demonstrate that Suspend-Up model is a Good Thing(tm) at least for some very important use cases; in addition - we'll show some very practical issues which currently prevent both co-routines and Resumable Expressions from becoming The Only Way of providing resumable handling at least for message passing programs.

avatar for Sergey Ignatchenko

Sergey Ignatchenko

Author, ITHare.com
Sergey has 20+ years of software development experience. In particular, he was a co-architect of a G20 online stock exchange, and a sole architect of a major online game with 400K+ simultaneous players. He's also known for his articles in CUJ, C++ Report, and Overload, as well as... Read More →

Friday September 29, 2017 9:00am - 10:00am
Meydenbauer TBA #6 Meydenbauer Center
Feedback form isn't open yet.

Attendees (19)