source: CIVL/examples/omp/atomics/atomic_update.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: 464 bytes
Line 
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 update
11 x++;
12 }
13 #pragma omp section
14 {
15 #pragma omp atomic update
16 x = x + y;
17 }
18 #pragma omp section
19 {
20 #pragma omp atomic update
21 x += y;
22 }
23 #pragma omp section
24 {
25 #pragma omp atomic update
26 x = y + x;
27 }
28 }
29 assert (x == 0 || x == 1);
30}
Note: See TracBrowser for help on using the repository browser.