monitor s{ condition c; condition t; int result; int computed; void complicatedCalculation(){ result = 42; computed = 1; signalc(c); signalc(t); } int askAboutUniverse(){ if (computed != 1){ waitc(t); } return result; } int getPizzaDiameter(){ if (computed != 1){ waitc(c); } return result; } init { result = 0; computed = 0; } } void server() { complicatedCalculation(); } void scientist() { cout << askAboutUniverse() << endl; } void pizzerman() { cout << getPizzaDiameter() << endl; } main(){ cobegin { server(); scientist(); pizzerman(); } }