Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement