source: CIVL/examples/omp/atomics/atomic_read_write_dot.c@ 397ae5f

main test-branch
Last change on this file since 397ae5f 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: 335 bytes
Line 
1#include<assert.h>
2struct T {
3 int x;
4 int y;
5};
6
7int main() {
8 struct T t = {1, 0};
9
10#pragma omp parallel sections
11 {
12 #pragma omp section
13 {
14 #pragma omp atomic read
15 t.y = t.x;
16 }
17 #pragma omp section
18 {
19 #pragma omp atomic write
20 t.x = 1 + 1;
21 }
22 }
23 assert (t.y == 1 || t.y == 2);
24}
Note: See TracBrowser for help on using the repository browser.