| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (28 out of 30)

start

This action invokes a procedure asynchronously:

Use the start action to start a procedure for asynchronous processing. The start action schedules the specified procedure for execution; processing then continues through any remaining statements within the calling rule or procedure. At some later time, the scheduler will actually invoke the started procedure.

When starting a remote procedure, because of this scheduling order, it is possible for the remote procedure to complete before the remainder of the calling rule or procedure. To invoke a procedure synchronously from a procedure, use the call statement, as described under call.

You cannot use the start action to obtain a return value from a procedure: any value returned by a started procedure is discarded. Use start with caution for operations such as writing to a file: by the time the started procedure executes, the data it was to write may no longer exist, or the stream it was to write to may no longer be open.

A started procedure cannot assume that the context that existed when it was scheduled still exists. Any amount of processing may have occurred between its scheduling and its invocation by the scheduler. Once the procedure starts, it can assume that nothing else in the KB will execute unless the procedure enters a wait state, as described under Allowing Other Processing.

Starting a Procedure

To start a procedure:

This action starts procedure, which is a procedure that requires arguments or does not. Separate all arguments with commas (,).

This example shows an action button that starts a procedure, using the this window statement to pass the current g2-window as the single argument of the procedure.


Starting a Procedure on a Remote G2 Process

To start a procedure on a remote G2 or G2 Gateway process:

This action starts procedure, with arguments or without, on another G2 process, using the specified interface object. An example is:



Hint: To start a procedure on a remote G2, you must declare the procedure as remote by using a remote procedure declaration. Remote procedure declarations are described in the G2 Developer's Guide.

Starting a Procedure with a Priority

To start any procedure with a non-default priority:

This action schedules the specified procedure at integer-expression, which you provide as a value from 1 to 10, 1 being the highest priority and 10 the lowest.

Specifying a priority overrides the default priority of the invoked procedure. Here is an example of the optional priority statement:


Starting a Procedure after a Time Interval

To start any procedure after a time interval:

This action schedules the specified procedure to execute at the current time, plus the given interval.


| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (28 out of 30)

Copyright © 1997 Gensym Corporation, Inc.