main
test-branch
|
Last change
on this file since bd7a43e 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:
473 bytes
|
| Line | |
|---|
| 1 | /* spawn.cvl: simple example of spawning two processes.
|
|---|
| 2 | * A good test for reduction: verification should avoid
|
|---|
| 3 | * exploring all interleavings. It should in fact
|
|---|
| 4 | * reduce to a single interleaving.
|
|---|
| 5 | * civl verify -inputN=10 spawn.cvl
|
|---|
| 6 | */
|
|---|
| 7 | #include<civlc.cvh>
|
|---|
| 8 |
|
|---|
| 9 | $input int N = 10;
|
|---|
| 10 |
|
|---|
| 11 | void f(int n) {
|
|---|
| 12 | int i = 0;
|
|---|
| 13 |
|
|---|
| 14 | $atomic {
|
|---|
| 15 | for (i=0; i<n; i++) ;
|
|---|
| 16 | $assert(i==n);
|
|---|
| 17 | }
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | void main() {
|
|---|
| 21 | $proc p = $spawn f(N);
|
|---|
| 22 | $proc q = $spawn f(N);
|
|---|
| 23 |
|
|---|
| 24 | $wait(p);
|
|---|
| 25 | $wait(q);
|
|---|
| 26 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.