source:
CIVL/mods/dev.civl.com/examples/backend/atomic2.c@
cb4d4f4
| Last change on this file since cb4d4f4 was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 223 bytes | |
| Rev | Line | |
|---|---|---|
| [41e6f4e] | 1 | #include<stdbool.h> |
| 2 | #include<assert.h> | |
| 3 | #include<civlc.cvh> | |
| 4 | $input int x; | |
| 5 | _Bool b=true; | |
| 6 | ||
| 7 | void foo(){ | |
| 8 | $atomic{ | |
| 9 | b=false; | |
| 10 | $when(x>0); | |
| 11 | b=true; | |
| 12 | } | |
| 13 | } | |
| 14 | ||
| 15 | void main(){ | |
| 16 | $proc p=$spawn foo(); | |
| 17 | assert(b); | |
| 18 | $wait(p); | |
| 19 | } |
Note:
See TracBrowser
for help on using the repository browser.
