XMesaCmplr19: MONITOR LOCKS manager.lock.l USING manager: Manager = BEGIN HandleProc: TYPE = PROCEDURE [handle: Handle, context: POINTER] RETURNS [stop: BOOLEAN _ FALSE]; Cache: TYPE = POINTER; ErrorType: TYPE = { handlesExist, -- can't Clear unless all handles are gone, if mustBeEmpty invalidHandle}; -- the handle is not a valid one Manager: TYPE = POINTER TO Object; Object: TYPE = PACKED RECORD [ lock: POINTER TO Lock, vector: POINTER TO Vector, initialSize, growBy: [0..256)]; Vector: TYPE = RECORD [ z: UNCOUNTED ZONE, handles: SEQUENCE count: CARD16 OF HandleReference]; HandleReference: TYPE = POINTER TO HandleRecord; HandleRecord: TYPE = RECORD [ stamp: CARD16, -- timestamp program, key: UNSPEC16, -- debug data cache: SEQUENCE COMPUTED CARD16 OF UNIT]; -- client's cache Lock: TYPE = RECORD [l: MONITORLOCK]; Handle: TYPE = PACKED RECORD [ stamp: CARD16, -- timestamp index: CARD16]; -- index into vector currentStamp: CARD16 _ 0; Error: ERROR [type: ErrorType] = CODE; DestroyHandle: ENTRY PROCEDURE [handle: Handle, manager: Manager] = BEGIN ENABLE UNWIND => NULL; [] _ ValidateHandle[handle, manager ! Error => GOTO invalid]; manager.vector.z.FREE[@manager.vector[handle.index]]; -- also clears HandleReference EXITS invalid => RETURN WITH ERROR Error[invalidHandle]; END; -- of DestroyHandle GetCache: ENTRY PROCEDURE [handle: Handle, manager: Manager] RETURNS [cache: Cache] = { ENABLE UNWIND => NULL; RETURN[@ValidateHandle[handle, manager ! Error => GOTO invalid].cache] EXITS invalid => RETURN WITH ERROR Error[invalidHandle]}; SetDebugData: ENTRY PROCEDURE [ handle: Handle, program, key: UNSPEC16, manager: Manager] = BEGIN ENABLE UNWIND => NULL; reference: HandleReference _ ValidateHandle[ handle, manager ! Error => GOTO invalid]; reference.program _ program; reference.key _ key; EXITS invalid => RETURN WITH ERROR Error[invalidHandle]; END; -- of SetDebugData GetDebugData: ENTRY PROCEDURE [handle: Handle, manager: Manager] RETURNS [program, key: UNSPEC16] = BEGIN ENABLE UNWIND => NULL; reference: HandleReference _ ValidateHandle[ handle, manager ! Error => GOTO invalid]; RETURN[reference.program, reference.key]; EXITS invalid => RETURN WITH ERROR Error[invalidHandle]; END; ValidateHandle: PROCEDURE [handle: Handle, manager: Manager] RETURNS [reference: HandleReference _ NIL] = BEGIN END; END. 8 from AR 294 and 1049 -- From HandleManager.mesa: ÊÏ•NewlineDelimiter ™J™šÏn œÏkœžœžœ˜CJšž˜J™šœ žœž œžœ˜?Jšžœžœžœ˜ —Jšœžœžœ˜šœ žœ˜JšœÏc:˜IJšœŸ ˜1J˜J˜—Jšœ žœžœžœ˜"šœ žœžœžœ˜Jšœžœžœ˜Jšœžœžœ˜J˜J˜—šœžœžœ˜Jš œž œžœ žœžœžœ˜G—Jšœžœžœžœ˜0šœžœžœ˜JšœžœŸ ˜JšœžœŸ ˜&Jš œžœžœžœžœžœŸ˜