1
0
Fork 0
This repository has been archived on 2021-11-03. You can view files and clone it, but cannot push or open issues or pull requests.
uni-m.cds-adv-prog/ex9.1/a.cpp

30 lines
364 B
C++
Raw Normal View History

2020-01-07 11:01:08 +01:00
#include <thread>
#include <string>
#include <iostream>
/*
* Compile with 'g++ -pthread a.cpp'
*
* The order of printing is not well-defined
*/
using namespace std;
void f1() {
cout << "Hello ";
}
void f2(const std::string& s) {
cout << s << endl;
}
int main() {
thread t1(f1);
thread t2{f2, "Parallel World!"};
t1.join();
t2.join();
return 0;
}