source:
CIVL/mods/dev.civl.com/examples/concurrency/civl172miss.cvl@
cb4d4f4
| Last change on this file since cb4d4f4 was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 361 bytes | |
| Line | |
|---|---|
| 1 | #include<civlc.cvh> |
| 2 | $input int N=3; |
| 3 | int y = 0; |
| 4 | |
| 5 | int proc(int pid) { |
| 6 | L1: y = $choose_int(2); |
| 7 | $atomic{ |
| 8 | y++; |
| 9 | $assert(pid != 0 || y != 3); |
| 10 | } |
| 11 | goto L1; |
| 12 | return 0; |
| 13 | } |
| 14 | |
| 15 | int main() { |
| 16 | $proc procs[N]; |
| 17 | |
| 18 | $atomic{ |
| 19 | for (int i = 0; i < N; i++) |
| 20 | procs[i] = $spawn proc(i); |
| 21 | } |
| 22 | for (int i = 0; i < N; i++) |
| 23 | $wait(procs[i]); |
| 24 | return 0; |
| 25 | } |
Note:
See TracBrowser
for help on using the repository browser.
