<<>> <> <> <> <> <<>> DIRECTORY FutureValues, Process; FutureValuesImpl: CEDAR MONITOR IMPORTS Process EXPORTS FutureValues = BEGIN FutureValue: TYPE = FutureValues.FutureValue; FutureValueObj: TYPE = FutureValues.FutureValueObj; <> Create: PUBLIC PROC [] RETURNS [fv: FutureValue] = { <> fv ¬ NEW[FutureValueObj]; }; WaitFor: PUBLIC ENTRY PROC [fv: FutureValue, useTimeout: BOOL ¬ FALSE, timeoutMSec: CARD ¬ 1000] = { TRUSTED { IF useTimeout THEN Process.SetTimeout[@fv.availableNow, Process.MsecToTicks[timeoutMSec]]; }; WAIT fv.availableNow; -- if timeout occurs, value will still be NIL, and fv.available will be FALSE; }; <> NowAvailable: PUBLIC ENTRY PROC [fv: FutureValue] = { <> fv.available ¬ TRUE; BROADCAST fv.availableNow; }; <<>> END.