To run any function pointer, functor, or lambda expression in a new thread of execution, pass it to the constructor of
std::thread, along with any number of arguments. For example, these two lines are functionally equivalent:
std::thread worker1(my_callable, "arg", anotherArg);
std::thread worker2([=] { my_callable("arg", anotherArg); });
The given callable with its arguments is invoked in a newly launched thread of execution prior to returning from the thread’s constructor. ...