_CORO - create a co-routine.

Usage:

#include <coro.h>
cptr = _coro(func[,stack,userbytes,arg1,arg2,...]);

Where:

void *func;
points to the function where the co-routine is to begin execution.
int stack;
is the number of words of space to allocate for the co-routine's stack segment. The default is 100 words.
int userbytes;
is the number of bytes of user data to allocate for the user structure associated with this coroutine. If you omit this argument, the default is zero.
arg1, arg2...
are the arguments for "func".
_coptr cptr;
is a co-routine identifier that can then be used to refer to the created co-routine in subsequent operations.

Description:

"_coro" creates a co-routine and returns an identifier that can be used to refer to the co-routine in subsequent operations. When control is initially passed to the co-routine, the co-routine will begin executing "func" with the arguments specified.

Note that the NSC run-time library could require up to 1000 words of stack when writing to files, so if the co-routine does any I/O, the stack size should be increased. Because of the nature of the NSC library, there's very little "cost" associated with allocating a large stack if you don't actually use the memory. Therefore, we recommend that you specify an ample "stack" argument to allow for I/O and error-handling.

See Also:

expl nsc coro

expl nsc lib _ccall

expl nsc lib _cret

expl nsc lib _resume

expl nsc lib _cdel

Copyright © 1996, Thinkage Ltd.