[ External Interface | Reference Manual | Alphabetic Index ]

peer_do_multitask(+Type)

Perform a multitasking phase.
Type
User defined term (term)

Description

This predicate is intended for use only in implementing peer multitasking for an external language interface.

Multitasking is done within this predicate. That is, a multitasking phase is initiated when the predicate is called, and when the multitasking phase is finished, the predicate returns. If the abort exception is raised during the multitasking phase, the multitasking phase is properly terminated before the abort continues.

Type is a user defined term that is passed to all the multitasking peers when the multitasking phase is initiated. This allows the programming of different types of multitasking situations. Type must be representable as an EXDR term.

This is the only way to initiate multitasking, so if the user wishes to to initiate multitasking from a peer, they should call this goal via an ERPC.

During a multitasking phase, multitasking peers are each given a time-slice in round-robin fashion. They are allowed to perform ERPC during the time-slice. (More precisely: they are allow to execute peer-side code that contains ERPCs).

To participate in peer multitasking, a peer should first be registered using peer_register_multitask/2. A peer can then initiate multitasking by calling peer_do_multitask/1 while the peer has control. The multitasking phase is started, and all registered peer will be informed during their time-slice that a multitasking phase has started. If the peer is interested in this particularly multitasking phase (as specified in Type), they should execute peer_multitask_confirm/0. The multitasking phase can be terminated by any peer by calling peer_multitask_terminate/0.

Modes and Determinism

Exceptions

(peer_multitask_empty)
No peer is currently registered for multitasking.

See Also

peer_register_multitask / 2, peer_multitask_terminate / 0, peer_multitask_confirm / 0