Chapter Contents |
Previous |
Next |
selectecb |
Portability: | SAS/C extension |
SYNOPSIS | |
DESCRIPTION | |
CAUTION |
SYNOPSIS |
#include <sys/types.h> #include <sys/socket.h> #include <lcsignal.h> int selectecb(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout, struct _ecblist *ecblist, size_t ecblcnt)
DESCRIPTION |
selectecb
is identical to
select
with the exception that, in addition to returning when the timeout
expires or when activity occurs on one of the specified sockets,
selectecb
also returns if one of the specified
ECBs (Event Control Blocks) is posted.
The
ecblist
argument is the address of an array of structures, each of which represents
one or more contiguous ECBs. Each structure contains two members, a count
of the number of ECBs, and the address of an array of ECBs. The count may
be
0
, in which case the
ECB array address is ignored.
The declaration for the
_ecblist
structure is as follows:
struct _ecblist { size_t count; unsigned *ecbarr; }
The ECB list is passed via the struct
_ecblist
for several reasons. It allows a static
ECB list to be used in many cases, since individual ECBs can easily be removed
by setting their
count
member to
0
. For applications
that have a large number of ECBs,
_ecblist
facilitates organizing them into arrays; this may slightly
improve the performance of
selectecb
, since fewer memory accesses are required to determine the addresses
of all the ECBs.
Note that an ECB may be POSTed at any time. Thus, you
cannot assume that no ECBs have been POSTed when
selectecb
returns with one or more socket descriptor bits set. An
ECB may have been POSTed between the time that
selectecb
was returning and the time that your program checked the
return code from
selectecb
.
If
ecblist
is
NULL
, or
ecblcnt
is
0
, or the count field of all the
_ecblist
structures is set to
0
, ECB waiting is not used and the effect is
exactly the same as if
select
had been called.
CAUTION |
The actual timing is not likely to be
accurate to the microsecond. Calls to
selectecb
may leave asynchronous signals blocked for long periods of
time.
For integrated sockets,
selectecb
may be interrupted by any unblocked signal, either managed
by USS or SAS/C, in which case
selectecb
will return
-1
, and errno will be set to
EINTR
. However, execution of
selectecb
is not interrupted by an USS signal unless the signal terminates
the process.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.