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...
We'll cover the following...
To launch a thread in C++, you have to include the <thread> header.
-
A thread
std::threadrepresents 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.
For example,