source:
CIVL/examples/backend/atomicExample.c@
682e8bb
| Last change on this file since 682e8bb was a552cec, checked in by , 10 years ago | |
|---|---|
|
|
| File size: 263 bytes | |
| Line | |
|---|---|
| 1 | $input int x; |
| 2 | int s=0; |
| 3 | |
| 4 | void foo(){ |
| 5 | $when(s>0); |
| 6 | $atomic{ |
| 7 | s--; |
| 8 | } |
| 9 | } |
| 10 | |
| 11 | void goo(){ |
| 12 | $atomic{ |
| 13 | s=1; |
| 14 | $when(x>0) |
| 15 | s*=2; |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | int main(){ |
| 20 | $proc fp, gp; |
| 21 | |
| 22 | $atomic{ |
| 23 | fp = $spawn foo(); |
| 24 | gp = $spawn goo(); |
| 25 | } |
| 26 | $wait(fp); |
| 27 | $wait(gp); |
| 28 | } |
Note:
See TracBrowser
for help on using the repository browser.
