source: CIVL/examples/backend/atomicExample.c@ bb03188

main test-branch
Last change on this file since bb03188 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
RevLine 
[c3bddc1]1#include<stdbool.h>
2#include<assert.h>
3#include<civlc.cvh>
[41e6f4e]4$input int x;
[c3bddc1]5_Bool b=true;
6int a=0;
[41e6f4e]7
8void foo(){
9 $atomic{
[c3bddc1]10 b=false;
11 $when(x>0);
12 b=true;
[41e6f4e]13 }
14}
15
16void goo(){
[c3bddc1]17 if(!b)
18 a=1;
[41e6f4e]19}
20
[c3bddc1]21void main(){
22 $proc pf, pg;
23
[41e6f4e]24 $atomic{
[c3bddc1]25 pf=$spawn foo();
26 pg=$spawn goo();
[41e6f4e]27 }
[c3bddc1]28 $wait(pg);
29 assert(a==0);
30 assert(b);
31 $wait(pf);
[41e6f4e]32}
Note: See TracBrowser for help on using the repository browser.