![]() Chapter Contents |
![]() Previous |
![]() Next |
| costart |
| Portability: | SAS/C extension |
| SYNOPSIS | |
| DESCRIPTION | |
| RETURN VALUE | |
| CAUTIONS | |
| RELATED FUNCTIONS | |
| SEE ALSO |
| SYNOPSIS |
#include coproc_t costart(void *(*func)(void *), struct costart_parms *p);
| DESCRIPTION |
The costart function creates
a new coprocess. Its argument is the address of the initial function to be
executed. The initial function should accept a void *
argument and return a void * value. This function
is not called until the first time the new coprocess is cocalled.
The p argument can be NULL or a pointer to a
struct costart_parms, which has the following definition (in <coproc.h>):
struct costart_parms {
unsigned stksize;
unsigned sigmask;
sigset_t *blocked_set;
unsigned _[3];
};
If p is a non-NULL
pointer, then the values of each of the members at the struct costart_parms it points to
is used when the coprocess is created. If p
is NULL, then default values are used.
The value in stksize is used as the size
of the initial stack allocation for the coprocess. This value must be at least
680 bytes. All values are rounded up to an even fraction of 4096. The default
initial stack allocation is 4096. Use of stksize
does not prevent the stack from being extended automatically if a stack overflow
occurs.
The sigmask and blocked_set arguments are used to specify the signal mask for the coprocess.
The sigmask field can be used to mask signals
that are managed by SAS/C, and the blocked_set
argument can be used to mask signals that are managed by either SAS/C or UNIX
System Services. sigmask is provided primarily
for backwards compatibility, and it is recommended that you use the sigprocmask function to establish a sigset_t object that contains the
mask information for both SAS/C
and UNIX System Services managed signals. The blocked_set
argument is then used to point to the sigset_t object.
If blocked_set is set to 0, the value
of sigmask is used to establish the signal
mask for the coprocess. The default value of sigmask
is 0xffffffff; that is, all signals are blocked.
This blocks interruptions until the new coprocess is ready. Refer to "Blocking
Signals" in Chapter 5 of SAS/C Library Reference, Volume 1 for
more information about the signal mask.
The _[3] field is reserved and must be
set to 0s.
| RETURN VALUE |
costart returns the ID
of the new coprocess or 0 if a new coprocess
could not be created.
| CAUTIONS |
All of the members in the costart_parms structure must be used. If you want to change only one of
the fields, you must set the other fields to their default value.
At most, 65,536 coprocesses (including the main coprocess created at program start-up) can exist simultaneously. In practice, because each coprocess needs stack space beow the 16-megabyte line, it will not be possible to create more than roughly 10,000 coprocesses. The exact limit depends on the operating system and region or virtual machine size.
| RELATED FUNCTIONS |
sigaddset
| SEE ALSO |
See Chapter 5, "Signal Handling Functions," in SAS/C Library Reference, Volume 1.
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.