source:
CIVL/examples/concurrency/civl174miss.cvl
| Last change on this file was ea777aa, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 351 bytes | |
| Rev | Line | |
|---|---|---|
| [e88e3e3] | 1 | #include<civlc.cvh> |
| 2 | $input int N=3; | |
| 3 | int y = 0; | |
| 4 | ||
| 5 | int proc(int pid) { | |
| [2aa4e6e] | 6 | L1: y = $choose_int(2); |
| 7 | $atomic{ | |
| [e88e3e3] | 8 | y++; |
| [2aa4e6e] | 9 | $assert(y!=N+1); |
| [e88e3e3] | 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.
