So that instead of having to do #incluce <spot/iface/ltsmin/ltsmin.hh> for using installed the installed header, and #incluce <iface/ltsmin/ltsmin.hh> for using the non-installed version, we now do #incluce <spot-if/ltsmin/ltsmin.hh> in both cases. * iface/: Rename as... * spot-if/: ... this. * doc/Doxyfile.in, README, configure.ac, Makefile.am, spot/sanity/80columns.test, spot/sanity/style.test: Adjust. * NEWS: Mention the change. * spot-if/ltsmin/Makefile.am: Install headers in $includedir/spot-if. * debian/libspot-dev.install: Distribute that directory as well.
63 lines
1.8 KiB
Text
63 lines
1.8 KiB
Text
// peterson mutual exclusion protocol for N processes
|
|
|
|
// Comes from http://anna.fi.muni.cz/models/cgi/model_info.cgi?name=peterson
|
|
// Also distributed with DiVinE (using dual GPL and BSD licences)
|
|
|
|
byte pos[4];
|
|
byte step[4];
|
|
|
|
process P_0 {
|
|
byte j=0, k=0;
|
|
state NCS, CS, wait ,q2,q3;
|
|
init NCS;
|
|
trans
|
|
NCS -> wait { effect j = 1; },
|
|
wait -> q2 { guard j < 4; effect pos[0] = j;},
|
|
q2 -> q3 { effect step[j-1] = 0, k = 0; },
|
|
q3 -> q3 { guard k < 4 && (k == 0 || pos[k] < j); effect k = k+1;},
|
|
q3 -> wait { guard step[j-1] != 0 || k == 4; effect j = j+1;},
|
|
wait -> CS { guard j == 4; },
|
|
CS -> NCS { effect pos[0] = 0;};
|
|
}
|
|
process P_1 {
|
|
byte j=0, k=0;
|
|
state NCS, CS, wait ,q2,q3;
|
|
init NCS;
|
|
trans
|
|
NCS -> wait { effect j = 1; },
|
|
wait -> q2 { guard j < 4; effect pos[1] = j;},
|
|
q2 -> q3 { effect step[j-1] = 1, k = 0; },
|
|
q3 -> q3 { guard k < 4 && (k == 1 || pos[k] < j); effect k = k+1;},
|
|
q3 -> wait { guard step[j-1] != 1 || k == 4; effect j = j+1;},
|
|
wait -> CS { guard j == 4; },
|
|
CS -> NCS { effect pos[1] = 0;};
|
|
}
|
|
process P_2 {
|
|
byte j=0, k=0;
|
|
state NCS, CS, wait ,q2,q3;
|
|
init NCS;
|
|
trans
|
|
NCS -> wait { effect j = 1; },
|
|
wait -> q2 { guard j < 4; effect pos[2] = j;},
|
|
q2 -> q3 { effect step[j-1] = 2, k = 0; },
|
|
q3 -> q3 { guard k < 4 && (k == 2 || pos[k] < j); effect k = k+1;},
|
|
q3 -> wait { guard step[j-1] != 2 || k == 4; effect j = j+1;},
|
|
wait -> CS { guard j == 4; },
|
|
CS -> NCS { effect pos[2] = 0;};
|
|
}
|
|
process P_3 {
|
|
byte j=0, k=0;
|
|
state NCS, CS, wait ,q2,q3;
|
|
init NCS;
|
|
trans
|
|
NCS -> wait { effect j = 1; },
|
|
wait -> q2 { guard j < 4; effect pos[3] = j;},
|
|
q2 -> q3 { effect step[j-1] = 3, k = 0; },
|
|
q3 -> q3 { guard k < 4 && (k == 3 || pos[k] < j); effect k = k+1;},
|
|
q3 -> wait { guard step[j-1] != 3 || k == 4; effect j = j+1;},
|
|
wait -> CS { guard j == 4; },
|
|
CS -> NCS { effect pos[3] = 0;};
|
|
}
|
|
|
|
|
|
system async;
|