FutureValues.mesa
Copyright © 1992 by Xerox Corporation. All rights reserved.
Contents: A mechanism that allows one application to place a request for a value on another application's queue and then block until the data is available.
Bier, June 30, 1993 10:41 pm PDT
FutureValues: CEDAR DEFINITIONS = BEGIN
FutureValue: TYPE = REF FutureValueObj;
FutureValueObj:
TYPE =
MONITORED
RECORD [
value: REF,
available: BOOL ¬ FALSE,
availableNow: CONDITION
];
Routines for Consumers of FutureValues
Create:
PROC []
RETURNS [fv: FutureValue];
Allocate a new FutureValue record to be queued.
WaitFor:
PROC [fv: FutureValue, useTimeout:
BOOL ¬
FALSE, timeoutMSec:
CARD ¬ 1000];
Wait until the produce has placed data in fv. If useTimeout is TRUE, then only wait for timeoutMSec. If the data in fv is valid, fv.available will be TRUE. Otherwise, it will be FALSE.
Routines for Producers of FutureValues
NowAvailable:
PROC [fv: FutureValue];
Informs the thread(s) that is(are) waiting for this value that it is now available.
END.