source: CIVL/examples/backend/atomicExample.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: 345 bytes
Line 
1#include<stdbool.h>
2#include<assert.h>
3#include<civlc.cvh>
4$input int x;
5_Bool b=true;
6int a=0;
7
8void foo(){
9 $atomic{
10 b=false;
11 $when(x>0);
12 b=true;
13 }
14}
15
16void goo(){
17 if(!b)
18 a=1;
19}
20
21void main(){
22 $proc pf, pg;
23
24 $atomic{
25 pf=$spawn foo();
26 pg=$spawn goo();
27 }
28 $wait(pg);
29 assert(a==0);
30 assert(b);
31 $wait(pf);
32}
Note: See TracBrowser for help on using the repository browser.