source: CIVL/examples/concurrency/spawn.cvl@ 46f0305

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since 46f0305 was 2fa36af, checked in by Manchun Zheng <zmanchun@…>, 13 years ago

make examples atomic

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@392 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 465 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.h>
8
9$input int N;
10
11void f(int n) {
12 int i = 0;
13
14$atomic{
15 for (i=0; i<n; i++) ;
16 $assert i==n;}
17}
18
19void main() {
20 $proc p = $spawn f(N);
21 $proc q = $spawn f(N);
22
23 $atomic{
24 $wait p;
25 $wait q;}
26}
Note: See TracBrowser for help on using the repository browser.