Let's analyze the previous four programs:
- std::thread: The following program shows basic thread usage for create and join:
There's nothing really complex in this first test. std::thread was initialized with a function through the uniform initialization and joined (waiting for the thread to be completed). The thread would accept a function object:
struct threadFunction { int speed; void operator ()();}std::thread t(threadFunction);
- std::thread: Create and join a thread, passing a parameter and getting a result:
This second ...