// "countdown-domino-b.hac"
// copy-modified from "countdown-domino-a.hac"
//	$Id: countdown-domino-b.hac,v 1.2 2007/01/21 06:02:46 fang Exp $
// concurrent but cascading counters waking each other up

int a, b, c;

chp {
[a != 0];	// condition wait
*[ (a > 0) -> a := a-1 ]; b:=2
}

chp {
b:=0;
[b != 0];	// condition wait
*[ (b > 0) -> b := b-1 ]; c:=3
}

chp {
c:=0;
[c != 0];	// condition wait
*[ (c > 0) -> c := c-1 ]
}

chp {
a := 0;
a := 1		// the kick off
}

// will eventually terminate with a, b, c = 0
// the initializations technically can race, 
// but we assume that 0 initialization precludes that situation

