On the perils of holding a lock across a coroutine suspension point--Raymond Chen

The series continue

On the perils of holding a lock across a coroutine suspension point, part 2: Nonrecursive mutexes

On the perils of holding a lock across a coroutine suspension point, part 3: Solutions

by Raymond Chen

From the article:

Last time, we looked at what can go wrong if you hold a recursive mutex across a coroutine suspension point. Do things get any better if you switch to a nonrecursive mutex?

CppCon 2019 Small is beautiful: Techniques to minimise memory footprint--Steven Pigeon

Registration is now open for CppCon 2021, which starts on October 24 and will be held both in person and online. To whet your appetite for this year’s conference, we’re posting videos of some of the top-rated talks from our most recent in-person conference in 2019 and our online conference in 2020. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2021 to attend in person, online, or both!

Small is beautiful: Techniques to minimise memory footprint

by Steven Pigeon

Summary of the talk:

When we code, we often assume that the computer has an infinite amount of memory. This is, of course, /very/ false. It is false for embedded programming, where memory is often limited to a few megabytes or even a few kilobytes, but it is also false for the most powerful workstations and servers. Using memory wisely makes your application possible on small systems as well as prevents, or at least reduces, scaling problems for larger applications. While some programming languages are designed to hide implementation details from the programmer, C++ allows the programmer to specify, with a good level of control, how memory is allocated, structured, and used. In this talk, we will explore what can be done at run-time with negligible cost, what can be done at compile-time with meta-programming, and how we can thwart default compiler behavior to achieve memory-efficient type-safe data representations. We will also extend the discussion to the higher-level reorganization of data structures in order to make a better use of memory.

On the perils of holding a lock across a coroutine suspension point, part 1--Raymond Chen

More about coroutines.

On the perils of holding a lock across a coroutine suspension point, part 1: The set-up

by Raymond Chen

From the article:

Say you want to perform a bunch of asynchronous operations involving some object state, but also want to make sure that no other tasks access that object state at the same time. For synchronous code, you would use a traditional synchronization object like a mutex or critical section...

CppCon 2020 Get Off My Thread: Techniques for Moving Work to Background Threads--Anthony Williams

Registration is now open for CppCon 2021, which starts on October 24 and will be held both in person and online. To whet your appetite for this year’s conference, we’re posting videos of some of the top-rated talks from our most recent in-person conference in 2019 and our online conference in 2020. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2021 to attend in person, online, or both!

Get Off My Thread: Techniques for Moving Work to Background Threads

by Anthony Williams

Summary of the talk:

If you're writing a GUI application and you want the interface to feel "responsive" to the user then you need the code that response to UI events to be short and fast. Similarly, if you are handling network I/O you may not want the processing of one request to prevent the system receiving further input.

If the work to be done in response to an event is complex and time consuming then you can maintain the "responsiveness" of the system by passing the work off to a background thread.

This talk will look at the ways of doing this, including managing ongoing work, providing progress updates, and cancelling work if it is no longer needed.

Be Wise, Sanitize - Keeping Your C++ Code Free From Bugs--Marin Peko

All is in the title.

Be Wise, Sanitize - Keeping Your C++ Code Free From Bugs

by Marin Peko

From the article:

For all of the losses it has inflicted, this pandemic has at least made us more conscious about our personal hygiene.

We’re spraying spaces, surfaces and our hands way more often, so why not sanitize our code while we’re at it? After all, software runs the world, and bugs that cause programs to malfunction can cause serious damage – much like their viral counterparts.

If you’re developing in C and C++, you know this all too well. It’s easy to allocate a piece of memory and forget to free it later, or accidentally write past the memory buffer. These issues are extremely hard to find without proper tools and often cause sporadic, sudden crashes.

Using sanitizers as you’re building and testing your program can help you catch a great deal of issues in your source code early on, including memory leaks, buffer overflows and undefined behavior.

Today, we’ll be taking a look at three types of Clang sanitizers, how they’re used and what bugs they can help us nip in the bud.

Let’s spray away!

C++20 three way comparison operator: Part 4--Gajendra Gulgulia

The series continue.

C++20 three way comparison operator: Part 4

by Gajendra Gulgulia

From the article:

In the third part of the tutorial series, I uncovered the mechanics of operator <=> and explained in detail, how the compiler re-writes the comparison expression on a custom object with only operator<=> declared as default and how additionally it can make use of synthesized expression to reverse the operands during expression re-writing process. If you haven’t read the third part, I strongly encourage you to read it before reading this tutorial...

CppCon 2019 Behind the Scenes of a C++ Build System--Jussi Pakkanen

Registration is now open for CppCon 2021, which starts on October 24 and will be held both in person and online. To whet your appetite for this year’s conference, we’re posting videos of some of the top-rated talks from our most recent in-person conference in 2019 and our online conference in 2020. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2021 to attend in person, online, or both!

Behind the Scenes of a C++ Build System

by Jussi Pakkanen

Summary of the talk:

Everyone has an opinion on what build systems should do but there are surprisingly few who have an understanding of how they do it. In this talk we shall look behind the curtain and examine what does it actually take to create a modern build system and how they go about their business of turning source code into either compiler errors or executables.

On this journey we shall learn about the wonders of supporting 10+ different platforms and toolchains, dependency management, the awesomeness (both ironically and not) of shared libraries, compiler bugs and the interesting requirements on tools used at the lowest layers of a modern operating system. Using the increasingly popular Meson build system we shall examine real world design choices and tradeoffs and how they affect the final end user development experience. Performance optimization is also examined by looking at how you can efficiently scale program compilation both up to a compilation cluster and down to something like a Raspberry Pi.

Armed with all this knowledge we should finally be able to answer the question of why almost all build systems have suffered from poor usability and maybe, just maybe, find a proper solution for the build and dependency problem.

Slides of the 24th of June 2021 BeCPP Meeting -- Marc Gregoire

On June 24th, 2021, the Belgian C++ Users Group had their next online event. The slides and other material are now available online.

Slides of the 24th of June 2021 BeCPP Meeting

by Marc Gregoire

About the event:

  • “A new way of formatting in C++20, are we getting there in the end?” by Lieven de Cock
  • “Understanding value categories in C++” by Kris van Rens

If you couldn't attend the event in person, or if you would like to go over the material again, you can download them from the BeCPP website.