Chapter Contents

Previous

Next
coproc

coproc



Return the ID of a Coprocess


SYNOPSIS
DESCRIPTION
RETURN VALUE
EXAMPLE


SYNOPSIS

#include <coproc.h>

coproc_t coproc(int name);


DESCRIPTION

coproc returns the coprocess identifier of a particular coprocess as specified by its integer argument. The argument should be specified as one of these three symbolic values: MAIN , SELF , or CALLER .

coproc(MAIN) returns the coprocess ID of the main coprocess, which is always created during program initialization. coproc(SELF) returns the ID of the coprocess currently running. coproc(CALLER) returns the ID of the coprocess that cocalled the current coprocess.


RETURN VALUE

coproc returns the ID of the specified coprocess or 0 if the argument does not specify a valid coprocess. coproc(CALLER) returns 0 if called from the main coprocess. Also note that coproc(MAIN) returns 0 if called after a call to exit , causing program termination.


EXAMPLE

#include <coproc.h>
#include <stdio.h>

   /* Test whether the main coprocess or some */
   /* other coprocess is running.             */
if (coproc(SELF) == coproc(MAIN))
   printf("main coprocess currently active.\n");


Chapter Contents

Previous

Next

Top of Page

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