ENDING - set co-routine to be called on return.

Usage:

B:
   ending( [fcv,] function );
C:
   void ending([void *fcv,] void *function);

Where:

fcv
identifies the co-routine to be set. If "fcv" is not specified, the default is the current co-routine.
function
is the function to be invoked if the identified co-routine returns from its highest level function.

Description:

ENDING sets up the indicated "fcv" to cause control to flow to the indicated "function" when the top level function in the co-routine (the one named in the CREATE call) does a return. This is not a true function call since arguments cannot be passed, but it is useful in specifying an action to be taken when control falls off the bottom of a routine (e.g. print a message, or call a "function" to DESTROY the offender). Specifying a "function" that takes no arguments works well.

The "function" indicated by ENDING cannot pass control by returning, since this only invokes "function" again. It must DETACH or EXIT or do something similar.

If ENDING has not been called for a co-routine and the top level routine returns, the effect will be the same as if the co-routine did a DETACH.

See Also:

expl b lib create

expl b lib destroy

expl b lib detach

Copyright © 1996, Thinkage Ltd.