Lib/sequencer offers Multitasking

From Liberty Eiffel Wiki
Revision as of 14:39, 4 January 2006 by Cadrian (talk | contribs) (still translating)
Jump to navigation Jump to search
*** OK, I'm translating that --Cyril 14:34, 4 Jan 2006 (CET)

The lib/sequencer library implements one kind of cooperative multi-tasking of the event-driver kind. Unlike "pure" cooperative multi-tasking, a task cannot stop at any time (using an hypothetic yield feature) but only in lnown and stable states. That is conform to the Eiffel principles.

The principle is:

  • the class LOOP_STACK manages the multi-tasking;
  • the class JOB represents a task. The task core is the continue feature, in which the task controls the whole system;
  • the class READY_DESCRIPTION allows to describe in which conditions a task can be executed.

We will successively see each of those concepts.

The multi-tasking manager

The class LOOP_STACK is in charge of managing the multi-tasking. It is used in two steps:

  • initialisation: creation of the LOOP_STACK object, and adding of the tasks to execute
  • execution: execution of the run feature

Of course, tasks can be added during the execution. The manager can also be stopped, thanks to the break feature.

Also, the loops stack is composed of many execution loops (LOOP_ITEM). This allows, for instance, the implementation of a kind of modality (see the modal windows in Vision).