Oberon || Library || Module Index || Search Engine || Definition || Module
TYPE Name = ARRAY 128 OF CHAR; VAR name: Name; VAR id: Name; VAR host: Name; TYPE ExitCode = INTEGER; VAR indicateSuccess: ExitCode; VAR indicateFailure: ExitCode; TYPE ExitEvent = POINTER TO ExitEventRec; TYPE ExitEventRec = RECORD (Events.EventRec) exitcode: ExitCode; END; VAR softTermination: Events.EventType; VAR termination: Events.EventType; VAR abort: Events.EventType; VAR startOfGarbageCollection: Events.EventType; VAR endOfGarbageCollection: Events.EventType; TYPE ExitProc = PROCEDURE (code: ExitCode); TYPE AbortProc = PROCEDURE; TYPE PauseProc = PROCEDURE; TYPE Interface = POINTER TO InterfaceRec; TYPE InterfaceRec = RECORD exit: ExitProc; abort: AbortProc; pause: PauseProc; END;
PROCEDURE SetHandlers(if: Interface); PROCEDURE TerminateSoftly; PROCEDURE Terminate; PROCEDURE Abort; PROCEDURE Exit(code: ExitCode); PROCEDURE Pause;
Three string variables are provided that are possibly initialized by more system-dependant modules. These strings can be empty in case they are unknown or not yet initialized.
Exit raises an event of type termination and causes the current process to be terminated. The exit code is passed to the invocation environment. Terminate calls Exit with an exit code of indicateSuccess. Process exits immediately without event handling in case of recursive calls of Exit or Abort.
TerminateSoftly raises an event of type softTermination that asks all running tasks to terminate. In comparison to Terminate, this method gives all tasks the opportunity to terminate gracefully. However, this termination succeeds only if all tasks honor directly or indirectly a softTermination event.
Abort raises an event of type abort and causes the current process to be aborted. This is suitable in case of serious programming errors where post mortem debugging could be of interest.
Pause suspends the execution of the current process. Some system dependent events which are raised from external sources are able to resume suspended processes.
SetHandlers is to be called during initialization time by a module which implements these operations for the given environment. The default interface of Process consists of procedures with endless loops.
Additionally, Process offers the event types startOfGarbageCollection and endOfGarbageCollection which may be used by garbage collectors to indicate start and end of their work (see Storage).
Oberon || Library || Module Index || Search Engine || Definition || Module