Advertisement
Guest User

Untitled

a guest
Jun 8th, 2021
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <thread>
  3. using namespace std;
  4.  
  5. class ATPG {
  6. public:
  7.     ATPG() {}
  8.     void test(int i, int j);
  9.     void test_thread();
  10. }
  11.  
  12. void ATPG::test(int i, int j) {
  13.     cout << i+j << endl;
  14. }
  15.  
  16. void ATPG::test_thread() {
  17.     int num1 = 3;
  18.     int num2 = 4;
  19.     int num3 = 1;
  20.     int num4 = 2;
  21.     thread t1(test, num1, num2);
  22.     thread t2(test, num3, num4);
  23.    
  24.     t1.join();
  25.     t2.join();
  26. }
  27.  
  28. int main()
  29. {
  30.     ATPG* atpg = new ATPG();
  31.     atpg->test_thread();
  32.     cout << "final finish" << endl;
  33.  
  34.     return 0;
  35. }
  36.  
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement