Advertisement
Guest User

Untitled

a guest
Jan 11th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <thread>
  3.  
  4. using namespace std;
  5.  
  6. void task2();
  7.  
  8. void task()
  9. {    
  10.     std::thread t2(task2);
  11.     t2.join();
  12. }
  13.  
  14. void task2()
  15. {
  16.     *(int *)0xdeadbeef = 42;
  17. }
  18.  
  19. int main(int argc, char **argv) {
  20.    
  21.     std::thread t1(task);
  22.     t1.join();
  23.    
  24.     std::cout << "\nthread has been executed";
  25.    
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement