xxxxxxxxxx
#include <thread>
void foo()
{
// do stuff...
}
int main()
{
std::thread first (foo);
first.join();
}
xxxxxxxxxx
std::thread* myThread = new std::thread[n];
for (int i = 0; i < n; i++)
{
myThreads[i] = std::thread(exec, i);
}
xxxxxxxxxx
void task1(std::string msg)
{
std::cout << "task1 says: " << msg;
}
std::thread t1(task1, "Hello");
t1.join();