DIRECTORY FIFO, FIFOGuardian, Process, RandomCard, WF; FIFODriver: MONITOR IMPORTS FIFO, FIFOGuardian, Process, RandomCard, WF = { p,q,r: PROCESS; i: CARDINAL; RandomYield: PROC = { THROUGH [0..RandomCard.Choose[0,1]] DO Process.Yield[] ENDLOOP}; Reader: PROC = { WF.WF0[" Reader started.*n"]; THROUGH [0..50) DO RandomYield[]; UNTIL FIFO.DataAvQ[] DO RandomYield[] ENDLOOP; FIFOGuardian.SetReadRequest[TRUE]; WF.WF1["%u ", FIFO.GetDataOut[]]; RandomYield[]; FIFOGuardian.SetReadRequest[FALSE]; ENDLOOP; WF.WF0[" Reader terminated.*n"]; }; Writer: PROC = { WF.WF0[" Writer started.*n"]; FOR i IN [0..50) DO RandomYield[]; UNTIL FIFO.SpaceAvQ[] DO RandomYield[] ENDLOOP; FIFOGuardian.SetDataIn[i]; FIFOGuardian.SetWriteRequest[TRUE]; WF.WF1["%u- ", i]; RandomYield[]; FIFOGuardian.SetWriteRequest[FALSE]; ENDLOOP; WF.WF0[" Writer terminated.*n"]; }; [] _ RandomCard.InitRandom[-1]; START FIFO.FIFOImpl; r _ FORK FIFO.Main[]; FIFO.SetInit[FALSE]; p _ FORK Reader[]; q _ FORK Writer[]; [] _ JOIN p; [] _ JOIN q; }.