source: CIVL/examples/concurrency/locksGood.cvl@ 23207c6

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since 23207c6 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: 344 bytes
Line 
1
2_Bool lock0 = 0;
3_Bool lock1 = 0;
4
5void proc0() {
6$atomic{
7 while (1) {
8 $when (!lock0) lock0=1;
9 $when (!lock1) lock1=1;
10 lock0=0;
11 lock1=0;
12 }}
13}
14
15void proc1() {
16$atomic{
17 while (1) {
18 $when (!lock0) lock0=1;
19 $when (!lock1) lock1=1;
20 lock0=0;
21 lock1=0;
22 }}
23}
24
25void main() {
26 $spawn proc0();
27 $spawn proc1();
28}
Note: See TracBrowser for help on using the repository browser.