SUMMARY - NSC functions pertaining to co-routines.

The NSC package supplies a set of basic primitives to allow co-routine processing: "_coro", "_resume", and "_cdel". "_coro" will allocate a stack segment and initialize its header, in order to create an instance of a co-routine. "_resume" will pass control from one co-routine to another. "_cdel" gets rid of a co-routine that is no longer needed, and makes its stack segment available for future use.

Although the above three routines are sufficient for co-routine processing, the NSC package supplies a number of additional functions to make programming easier.

The NSC package also supports a parent-child relationship between co-routines. Besides the use of "_resume", another co-routine may be invoked by the use of "_ccall". This establishes the calling routine as the parent of the called routine (the child). A child co-routine may return control to its parent with a call to "_cret", without explicitly naming or knowing the identity of the parent. The parent is inherited by any routine resumed by the child. In fact, the routine that does the "_cret" is normally not the co-routine named in the original "_ccall" by the parent.

In order to use any of the co-routine functions, you should put

#include <coro.h>

at the beginning of a source file that uses the routines. Amongst other things, this #include file contains a typedef for "_coptr", an argument type that is used by all co-routine calls to identify co-routines (much as the FILE * type identifies I/O streams in all I/O calls). The <coro.h> #include file is part of the EASEE Run-time library, not the standard NSC library, so you must use the option

i=runtime/8cz1.1/include

on the command line when you compile this type of source file.

See Also:

expl nsc coro

expl nsc lib _coro

expl nsc lib _ccall

expl nsc lib _cret

expl nsc lib _resume

expl nsc lib _cdel

Copyright © 1996, Bull HN and Thinkage Ltd.