Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <thread>
  3. #include <sstream>
  4.  
  5. void f1() {
  6.     for(;;) {
  7.         std::stringstream stream;
  8.         stream << "f1" << std::endl;
  9.         std::cout << stream.str();
  10.     }
  11. }
  12.  
  13. void f2() {
  14.     for(;;) {
  15.         std::stringstream stream;
  16.         stream << "f1" << std::endl;
  17.         std::cout << stream.str();
  18.     }
  19. }
  20.  
  21. int main() {
  22.     std::thread t1(f1);
  23.     std::thread t2(f2);
  24.  
  25.     t1.join(); t2.join();
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement