BACI System: C-- to PCODE Compiler in C, 11:30 1 Oct 2012 Source file: zad3.cm Mon Dec 10 11:50:29 2018 line pc 1 0 monitor s{ 2 0 condition c; 3 0 condition t; 4 0 int result; 5 0 int computed; 6 0 void complicatedCalculation(){ 7 1 result = 42; 8 4 computed = 1; 9 7 signalc(c); 10 9 signalc(t); 11 11 } 12 13 int askAboutUniverse(){ 13 14 if (computed != 1){ waitc(t); } 14 21 return result; 15 25 } 16 27 int getPizzaDiameter(){ 17 28 if (computed != 1){ waitc(c); } 18 35 return result; 19 39 } 20 41 init { result = 0; computed = 0; } 21 48 } 22 48 23 48 void server() { complicatedCalculation(); } 24 52 void scientist() { cout << askAboutUniverse() << endl; } 25 58 void pizzerman() { cout << getPizzaDiameter() << endl; } 26 64 27 64 main(){ 28 65 cobegin { server(); scientist(); pizzerman(); } 29 76 }