B: ending( [fcv,] function );
C: void ending([void *fcv,] void *function);
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.
Copyright © 1996, Thinkage Ltd.