#include <thread>
#include <iostream>
#include <vector>
#include <chrono>
void sleepThread(int sec, int number) {
std::this_thread::sleep_for(std::chrono::milliseconds(sec * 1000));
std::cout << "Therad " << number << " end work" << std::endl;
}
int main() {
std::thread first(sleepThread, 5, 0);
std::thread second(sleepThread, 2, 1);
second.join();
first.join();
system("pause");
return 0;
}
Comments
0 B
|👍
/👎