Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <omp.h>
  3.  
  4. int main()
  5. {
  6.     int a = 70;
  7.  
  8. #pragma omp parallel shared(a) num_threads(8)
  9.     {
  10.         printf("number = %i\n", omp_get_thread_num());
  11.  
  12. #pragma omp critical
  13.         {
  14.             --a;
  15.         }
  16.     }
  17.  
  18.     printf("a = %i", a);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement