Answers for "how to to launch a new thread c++"

C++
1

create n threads cpp

std::thread* myThread = new std::thread[n];
for (int i = 0; i < n; i++)
{
	myThreads[i] = std::thread(exec, i);
}
Posted by: Guest on January-07-2022
0

c++ create thread

void task1(std::string msg)
{
    std::cout << "task1 says: " << msg;
}

std::thread t1(task1, "Hello");

t1.join();
Posted by: Guest on March-20-2021

Browse Popular Code Answers by Language