76 lines
1.1 KiB
Java
Executable file
76 lines
1.1 KiB
Java
Executable file
process vassoio{
|
|
int b = 0;
|
|
entry piero_rosa(in String inMess, out String outMess);
|
|
boolean attesaPiero = false;
|
|
|
|
call mario.friggi(b);
|
|
b = 30;
|
|
while(true){
|
|
accept piero_rosa(in String inMess, out String outMess)
|
|
{
|
|
if(inMess=="piero"){
|
|
b--;
|
|
if(b==0){
|
|
outMess = "finiti";
|
|
attesaPiero = true;
|
|
setTimer(0);
|
|
}
|
|
else{
|
|
outMess = "non finiti";
|
|
}
|
|
}
|
|
else if(inMess=="rosa"){
|
|
call mario.friggi(b);
|
|
b = 30;
|
|
if (attesaPiero) {
|
|
attesaPiero = false;
|
|
call Piero.riprendi();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
process Mario{
|
|
entry friggi(in int b_rimasti);
|
|
|
|
while(true){
|
|
accept friggi(in int b_rim)
|
|
{
|
|
if(b_rim>0){
|
|
<butta>
|
|
}
|
|
<friggi>
|
|
setTimer(60);
|
|
}
|
|
}
|
|
}
|
|
|
|
process Piero{
|
|
entry cliente();
|
|
entry riprendi();
|
|
String mess;
|
|
|
|
while(true){
|
|
accept cliente() // Aspetta un cliente
|
|
{
|
|
call vassoio.piero_rosa("piero");
|
|
<servo clienti>
|
|
}
|
|
if (mess == "finiti") {
|
|
accept riprendi()
|
|
}
|
|
}
|
|
}
|
|
|
|
process Rosa{
|
|
while(true){
|
|
waitTimer();
|
|
call vassoio.piero_rosa("rosa");
|
|
}
|
|
}
|
|
|
|
process Cliente{
|
|
call Piero.cliente(); // Chiede a Piero un bombolone
|
|
<Mangia bombolone>
|
|
}
|