Creation of Threads

This lesson gives an introduction on how to create threads in C++ using callable units such as functions and lambda functions.

We'll cover the following

To launch a thread in C++, we have to include the <thread> header.

  • A thread std::thread represents an executable unit. This executable unit, which the thread immediately starts, gets its work package as a callable unit.

  • A callable unit is an entity that behaves like a function. Of course, it can be a function, but also a function object or a lambda function.

Example #

Get hands-on with 1200+ tech skills courses.