Advertisement
Guest User

main.cpp

a guest
Sep 12th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <chrono>
  3. #include <thread>
  4.  
  5. using std::cout;
  6.  
  7. void f() {
  8.     std::chrono::seconds sleep_time(1);
  9.     while (1) {
  10.         cout << "rendering...\n";
  11.         std::this_thread::sleep_for(sleep_time);
  12.     }
  13. }
  14.  
  15. int main() {
  16.     cout << "1\n";
  17.     cout << "2\n";
  18.     std::thread t(f);
  19.     cout << "3\n";
  20.     cout << "4\n";
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement