#include <iostream>
#include <thread>
#include <vector>;
using namespace std;
void go(int p) {
while (1) {
cout << p << endl;
}
}
void main() {
for (int i = 0; i <= 2; i++) {
thread a(go, i);
a.join();
cout << 123;
}
}
#include <iostream>
#include <thread>
#include <vector>;
using namespace std;
void go(int p) {
while (1) {
cout << p << endl;
}
}
void main() {
thread *t[3];
for (int i = 0; i <= 2; i++) {
t[i] = new thread(go, i);
cout << 123;
}
for (int i = 0; i <= 2; i++) {
t[i]->join();
delete t[i];
}
}