Chapter Contents

Previous

Next
Coprocessing Functions

Coprocess Data Types and Constants

The header file <coproc.h> must be included (via a #include statement) in any compilation that uses the coprocessing feature. In addition to declaring the coprocessing functions, the header file also defines certain data types and constants that are needed when coprocesses are used. These definitions from <coproc.h> are as follows:

typedef unsigned coproc_t;

   /* cocall/coreturn error code */
#define CO_ERR (char *) -2

   /* coproc argument values */
#define MAIN 0
#define SELF 1
#define CALLER 2

   /* costat return values -- coprocess states */
#define ENDED 0
#define ACTIVE 1
#define BUSY 2
#define IDLE 4
#define STARTING 8

The data type coproc_t defines the type of a coprocess identifier. Coprocess IDs are described in more detail in Coprocess Identifiers.

The value CO_ERR is returned by cocall and coreturn when the requested function cannot be performed. You should avoid passing this value as an argument to cocall or coreturn , because it can be misinterpreted by the paired function as indicating a program error rather than a correct return value. Note that NULL can be used as a cocall or coreturn argument. This is the recommended way to signify no information.

<coproc.h> also defines the type struct costart_parms , which is a structure containing start-up information for a coprocess, such as an estimate of the required stack size. The address of a structure of this type is passed to costart when a new coprocess is created. See costart for more information on the uses for this structure.


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.