SHARE
TWEET

Untitled

a guest Dec 9th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top