| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (13 out of 25)

call

This statement allows you to invoke another procedure synchronously from within the current procedure. The calling procedure suspends execution, and remains suspended until the called procedure returns. The calling procedure then resumes execution. The syntax is:

where:


A local name in which G2 places a return value of the called procedure. The number of local names must not exceed the number of values returned by the called procedure. See return for details on providing return values.

A procedure name or a reference to a procedure name, such as the procedure that is the-open-procedure-of tank-1.

An item or value used by the specified procedure. Specify multiple arguments by separating them with commas.

Designates the name of a G2-to-G2 interface or a G2 Gateway (GSI) interface that G2 uses to call a procedure that is running on another G2 process.


Note: A called procedure runs at the same priority as that of the calling procedure, not at the priority declared in its Default-procedure-priority attribute.

Calling and Wait States

When one procedure calls another in the local G2, the calling procedure does not enter a wait state. The called procedure may or may not enter a wait state, depending on its code. For information about wait states see Allowing Other Processing.

However, in a call ... across, G2 cannot predict the response time of the remote system, so it enters a wait state and allows other processing for the duration of the call. The wait state avoids needless suspension of the local G2 or timeout of the calling procedure.


Caution: When a procedure returns from a wait state, the environment in which it executes may have changed in ways that invalidate the procedure's assumptions. Be sure to revalidate the environment as needed before continuing execution of the procedure.

Asynchronous Invocation

To invoke a procedure asynchronously, use the start action, as described under start.

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (13 out of 25)

Copyright © 1997 Gensym Corporation, Inc.