HPlogo Asynchronous Serial Communications Programmer's Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 8 Intrinsics Reference

IOWAIT

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

Initiates completion operations for an I/O request. Delays program processing until an I/O operation completes.

Syntax

 I16          I16V    UDS    I16     U16
fnum:=IOWAIT(filenum,buffer,length,cstation);

Use

The IOWAIT intrinsic initiates completion operations for an I/O request and suspends the calling process until some I/O completes.

A call to either IOWAIT or its companion intrinsic, IODONTWAIT, must follow every read or write request posted against a file that was opened with NOWAIT I/O specified in the FOPEN or HPFOPEN call. (The process must have been running in privileged mode for NOWAIT I/O to have been specified.)

When NOWAIT I/O is used the parameters associated with the IODONTWAIT or IOWAIT call receive the values that normally would have been returned in the read or write request. See the parameter explanations that follow for what these values represent.

If you call IOWAIT and no I/O has completed, the calling process is suspended until some I/O completes.

If you call IODONTWAIT and no I/O has completed, control is returned to the calling process, CCE is returned, and the result of IODONTWAIT is zero.

Functional Return

fnum

16-bit signed integer (assigned functional return)

The file number for which the completion occurred. If no completion occurred, zero is returned.

Parameters

filenum

16-bit signed integer by value (required)

The file number for which there is a pending I/O request. If you specify 0, the IOWAIT intrinsic checks for any I/O completion.

buffer

user-defined structure (optional)

Passes an input buffer. Since terminals always operate without system buffering, it is not necessary for this parameter to follow a read.

length

16-bit signed integer by reference (optional)

Returns the length of the received or transmitted record. If the original request specified a byte count, the integer represents bytes. If the original request specified halfwords, the integer represents halfwords. This parameter is pertinent only if the original I/O request was a read request. The FREAD intrinsic always returns zero as its functional return if you specify NOWAIT I/O. Instead, the actual record length is returned in the length parameter of IOWAIT.

cstation

16-bit unsigned integer by reference (optional)

Not meaningful for asynchronous devices.

Condition Codes

CCE

Request granted. I/O completion occurred with no errors.

CCG

An end-of-file condition was encountered.

CCL

Request denied. Normal I/O completion did not occur because there were no I/O requests pending, a parameter error occurred, or an abnormal I/O completion occurred.

Special Considerations

You must be running in privileged mode to specify the NOWAIT I/O option in the FOPEN/HPFOPEN call.

Additional Discussion

See the discussion of initiating completion operations for I/O requests in Accessing Files Programmer's Guide. See also discussions of FOPEN, HPFOPEN and IODONTWAIT in this manual.

Feedback to webmaster