source: CIVL/examples/omp/atomics/atomic_read_write_array.c@ beab7f2

main test-branch
Last change on this file since beab7f2 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

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

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