Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
#include "stdafx.h"
#include <thread>
#include <vector>
#include <iostream>
void foo(std::size_t i)
{
// nothing to do
}
int main()
{
std::vector<std::thread> ths;
std::size_t n;
std::cin >> n;
for (std::size_t i = 0; i < n; ++i)
ths.push_back(std::thread(&foo, i));
for (auto & th : ths)
th.join();
return 0;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question