HP 3000 Manuals

New HPSELECT Intrinsic [ COMMUNICATOR 3000 MPE MPE/iX RELEASE 4.0 ] MPE/iX Communicators


COMMUNICATOR 3000 MPE MPE/iX RELEASE 4.0

New HPSELECT Intrinsic 

by Majid Mohazzab 
Commercial Systems Division 

The new MPE/iX intrinsic, HPSELECT, makes it possible to determine
whether a file or a group of files in a process is ready to perform
reads, writes, or has an exception.  The HPSELECT intrinsic optionally
blocks the process on one or more of these events if the condition is not
currently true.  Unlike the IOWAIT intrinsic, no I/O is necessary prior
to an HPSELECT call.  Users can call HPSELECT to see which files can have
I/O issued to them without blocking.  The files that are reported ready
for I/O, can be read or written immediately.  The syntax for HPSELECT is
as follows:

SYNTAX 

     select_result := HPSELECT ( number_of_files, read_mask, write_mask,
                                         exception_mask, timeout, status);

The caller passes in (optionally) three file masks that specify which
conditions should be checked for each file.  Each mask is a bitmap
representing the files that the caller can either read from, write to, or
get an exception case on without blocking.  If any of the specified
conditions are true, HPSELECT returns with the masks modified to indicate
which conditions are true.  If none of the specified conditions are true,
the process blocks until one of the specified conditions becomes true.
When HPSELECT returns, the functional return, select_result, contains the
number of files that have selected true.

A timeout parameter that is optional is also provided to allow the caller
to specify a maximum amount of time that the caller wants to wait for the
specified conditions to be true.  If the timer pops before one of the
conditions becomes true, the functional return is a 0; and if the
optional status parameter was passed, a timeout status is returned.  If
no masks are provided and a timeout is specified, HPSELECT blocks for the
timeout duration, (unless a soft interrupt occurs).

For this MPE/iX release, the file types that support HPSELECT are NetIPC
and BSD SOCKETS. For all other file types, read, write, and exception
always select TRUE whether the specified operation would block or not.

FUNCTIONAL RETURN A positive value is returned when one or more files
have selected TRUE. The value represents the number of files that have
selected TRUE.

A 0 is returned if a timeout value had been supplied and the select timed
out.

A -1 is returned if an error occurred.  This means an error in the call
or an internal error.

A -1 is also returned if a soft interrupt occurred before any of the
selected events occurred or before the time limit expired.



MPE/iX Communicators