Anonymous user
Concurrent computing: Difference between revisions
Updated to only use standard libraries. Removed comments as language should allow simple enough code.
m (Updated whitespace.) |
(Updated to only use standard libraries. Removed comments as language should allow simple enough code.) |
||
Line 210:
int main() {
std::random_device rd;
std::mt19937 eng(rd());
std::uniform_int_distribution<> dist(1,1000);
std::vector<std::thread> threads;
for (const auto& str: {"Enjoy\n", "Rosetta\n", "Code\n"}) {
std::chrono::milliseconds duration(dist(eng));
threads.emplace_back([str, duration]() {
Line 222 ⟶ 220:
});
}
for (auto& t: threads)
t.join();
return 0;
}</lang>
|