Answers for "cpp make for use threads"

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
6

c++ create threads

#include <thread>
void foo() 
{
  // do stuff...
}
int main() 
{
  std::thread first (foo);
  first.join();
}
Posted by: Guest on July-07-2020

Browse Popular Code Answers by Language