1.23
2.0
main
test-branch
|
Last change
on this file since 4f22a92 was 2c448829, checked in by Manchun Zheng <zmanchun@…>, 12 years ago |
|
Improve the implementation for $atomic and $atom statements, taking into account non-determinism, blocking, loop, etc in $atomic blocks.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@379 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100644
|
|
File size:
387 bytes
|
| Rev | Line | |
|---|
| [2c448829] | 1 | #include <civlc.h>
|
|---|
| 2 |
|
|---|
| 3 | int x = 1;
|
|---|
| 4 | int y = 0;
|
|---|
| 5 | int z = 0;
|
|---|
| 6 | int sum = 0;
|
|---|
| 7 |
|
|---|
| 8 | void foo(int i){
|
|---|
| 9 | $atomic{
|
|---|
| 10 | y = y + i;
|
|---|
| 11 | z++;
|
|---|
| 12 | $when(x==0)
|
|---|
| 13 | switch(y){
|
|---|
| 14 | case 1: sum += 1*i; break;
|
|---|
| 15 | case 2: sum += 2*i; break;
|
|---|
| 16 | case 3: sum += 3*i; break;
|
|---|
| 17 | };
|
|---|
| 18 | }
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | void main(){
|
|---|
| 22 | $spawn foo(1);
|
|---|
| 23 | $spawn foo(2);
|
|---|
| 24 | $when (z==2) x = 0;
|
|---|
| 25 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.