February 2020
Intermediate to advanced
292 pages
8h 54m
English
In this section, we'll learn how to use std::thread with a basic scenario (create and join) and how to pass and receive parameters to it:
#include <iostream>#include <thread>void threadFunction1 ();int main(){ std::thread t1 {threadFunction1}; t1.join(); return 0;}void threadFunction1 (){ std::cout << "starting thread 1 ... " << std::endl; std::cout << "end thread 1 ... " << std::endl;}
The second example is similar to the previous one but in this case, we pass and get parameters:
Read now
Unlock full access