Oberon || Library || Module Index || Search Engine || Definition || Module


Ulm's Oberon Library:
PathConditions


NAME

PathConditions - wait until a path of Names becomes valid

SYNOPSIS

TYPE Condition = POINTER TO ConditionRec;
TYPE ConditionRec = RECORD (Conditions.ConditionRec) END;


CONST noRoot = 0; invalidPath = 1; serverFailure = 2; CONST accessFailed = 3; termination = 4; CONST errors = 5; TYPE ErrorCode = SHORTINT; TYPE ErrorEvent = POINTER TO ErrorEventRec; TYPE ErrorEventRec = RECORD (Events.EventRec) errorcode: ErrorCode; END; VAR error: Events.EventType; VAR errormsg: ARRAY errors OF Events.Message;

PROCEDURE Create(VAR cond: Condition; path: ARRAY OF CHAR; root: Names.Node; auth: Shards.Lid); PROCEDURE CreateCS(VAR cond: Condition; path: ConstStrings.String; root: Names.Node; auth: Shards.Lid); PROCEDURE GetNode(cond: Condition; VAR node: Names.Node; errors: RelatedEvents.Object) : BOOLEAN;

DESCRIPTION

PathConditions offers conditions which allow to wait until a path of Names becomes valid. As in Paths, a path is a string whose components are separated by Paths.separator (a slash).

Create and CreateCS create a condition which evaluates to TRUE when path (taken relatively to root) becomes accessible or a fatal error occurs (see below). The authorization lid auth is passed to all operations of Names, namely Names.GetNode and Names.TakeInterest. Note that this condition cannot be recycled, i.e. if it once becomes TRUE, it remains TRUE.

Please note that all conditions by PathConditions are aborted if the process terminates, i.e. if Process.termination or Process.softTermination is raised. This allows the tasks associated with each condition to terminate as well.

GetNode waits for cond becoming TRUE (if this has not been done already), and returns on success the node, or, in case of fatal errors, relates all error events to errors.

DIAGNOSTICS

If PathConditions is enforced to abort a condition, it forwards the error events of Names and generates always an error event of its own:
noRoot
The root parameter of Create or CreateCS is terminated (see Resources).
invalidPath
One of the intermediate components of path does not have the Names.domainCap capability.
serverFailure
The Names implementation of one of the nodes of path did not return error events of Names. This makes it impossible to distinguish between Names.nodeNotFound and other access failures.
accessFailed
PathConditions was unable to access one of the path components -- probably due to insufficient authorization.
termination
The condition is aborted because Process.termination or Process.softTermination is raised.
Note that error events of PathConditions include the path if printed with Errors.Write or Conclusions.Conclude.

SEE ALSO

Tasks
synchronisation primitives
Names
abstraction for name hierarchies
Paths
accessing objects by paths
Process
process termination events
RelatedEvents
error handling

BUGS

PathConditions shares the path component separator with Paths but not the interpretation that pairs of separators are considered as one separator which is part of the name of a component. Instead, sequences of separators are taken as one separator.

PathConditions expects from all implementations of Names with domain capability that terminated objects (see Resources) vanish automatically together with the correct generation of member events if requested to do so. Otherwise, the conditions of PathConditions may hang longer than expected.


Edited by: borchert, last change: 2006/08/21, revision: 1.4, converted to HTML: 2006/08/21

Oberon || Library || Module Index || Search Engine || Definition || Module