source: CIVL/examples/omp/atomics/atomic_read_write.c@ afc300c

1.23 2.0 main test-branch
Last change on this file since afc300c was 5bea123, checked in by Ziqing Luo <ziqing@…>, 7 years ago

Implemented the transformation of OpenMP atomic operations

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5120 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 293 bytes
RevLine 
[5bea123]1#include<assert.h>
2
3int main() {
4 int x = 0;
5 int y = 0;
6#pragma omp parallel sections
7 {
8 #pragma omp section
9 {
10 #pragma omp atomic read
11 y = x;
12 }
13 #pragma omp section
14 {
15 #pragma omp atomic write
16 x = 1 + 1;
17 }
18 }
19 assert (y == 0 || y == 2);
20}
Note: See TracBrowser for help on using the repository browser.