source: CIVL/examples/concurrency/spawn.cvl@ 5bc08d6

1.23 2.0 main test-branch
Last change on this file since 5bc08d6 was 3ff27cf, checked in by Manchun Zheng <zmanchun@…>, 11 years ago

updated examples since $assert/$assume has been changed to functions; fixed the model builder for the new side-effect remover.

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

  • Property mode set to 100644
File size: 495 bytes
RevLine 
[20d2740]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 */
[e6b02c8]7#include<civlc.cvh>
[20d2740]8
[0baeebd]9$input int N = 10;
[20d2740]10
[34760dc]11void f(int n) {
[20d2740]12 int i = 0;
[2fa36af]13
[8b354468]14 $atomic {
15 for (i=0; i<n; i++) ;
[3ff27cf]16 $assert((i==n));
[8b354468]17 }
[34760dc]18}
19
20void main() {
[20d2740]21 $proc p = $spawn f(N);
22 $proc q = $spawn f(N);
23
[8b354468]24 $atomic {
[a82987f]25 $wait(p);
26 $wait(q);
[8b354468]27 }
[34760dc]28}
Note: See TracBrowser for help on using the repository browser.