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

Ulm's Oberon Library:


SysMain - determine initialization order


VAR mainTaskFinished: Events.EventType;


SysMain is initialized by the runtime startoff after building up the data structures of SysModules and serves as handle for code which determines the initialization order of the other modules.

Not all modules which are linked together need to be initialized. This could be useful if the decision about the module selection depends on command line arguments or the environment.

The module bodies protect themselves against multiple executions and each module body calls the initialization part of all imported modules.

The default implementation of SysMain creates a task group of RoundRobin (which becomes the default task group of Tasks) and adds as first task a coroutine which initializes all modules in linkage order:

PROCEDURE InitAllModules;
      module: SysModules.Module;
   module := SysModules.modules;
   WHILE module # NIL DO
      module := module.next;
END InitAllModules;

Note that SysMain, and, in consequence, the process does not necessarily terminate when InitAllModules terminates. SysMain returns when there are no living tasks of the main task group (InitAllModules is just one of these tasks).

The SysMain implementation is expected to raise an event of the type mainTaskFinished as soon as all modules are initialized. This gives all modules the opportunity to shutdown unneeded tasks to allow the process to terminate if no real activities continue.


round robin scheduler which manages the main task group
general scheduler interface which is supported by RoundRobin
list of modules

Edited by: borchert, last change: 2004/03/02, revision: 1.6, converted to HTML: 2004/03/03

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