| ||
Tutorial: Concurrency |
Concurrency is a large and interesting topic, so this will only scratch the surface. How does it look?
Concurrency is based on components, as introduced in the
section about co-routines, but
we need to use one of the built-in attributes
of
aCmp.fork , where aCmp
must be some specialization of the component
basic pattern. Similarly, to kill a running thread which
is associated with a particular component, use:
aCmp.kill . There ought to have been a similar
command suspend , but since (for historical reasons) there
is a special imperative SUSPEND , the grammar does not
allow this. Instead, temporarily, the following command has been
defined on components:
aCmp._suspend would be to suspend that
component, as if a SUSPEND imperative had been executed
in that thread. Please note that the current implementation of
aCmp._suspend only supports suspending a
component during its own execution, i.e. you cannot "suspend somebody
else." Finally, to handle run-time errors and manage threads in
general, the following command has been defined but not implemented:
aCmp.status is to detect
whether aCmp is running, suspended, or terminated, and in
case is has terminated, it should somehow deliver information about
the termination status of the component. This could be "Normal,"
"Divide by zero," "NONE-Reference," or whatever might stop a thread.
Example 9
This example is probably best executed in running mode (don't give the
This actually finishes the main topics. The only things left now for the next and following sections are various odds and ends which are nevertheless needed. |