Function | Package: mp | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 New since the initial 10.1 release.

## wait-for-io-available

Arguments: input-streams output-streams &key input-wait-function output-wait-function whostate timeout

This function was added by a patch in May, 2019. It is for version 10.1 and later.

This function is similar to wait-for-input-available but allows an application to wait for output possible on one set of streams as well as for input availble on another set.

The function returns `nil` or a list of items of the form `(stream . status)` where `stream` is a stream from one of the lists in the first two arguments and `status` is one of the following keywords:

- `:in`: the associated `stream` is one of the input-streams and the input-wait-function returned a non-`nil` value.
- `:in-error`: the associated `stream` is one of the input-streams and the input-wait-function signaled an error.
- `:out`: the associated `stream` is one of the output-streams and the output-wait-function returned a non-`nil` value.
- `:out-error`: the associated `stream` is one of the output-streams and the output-wait-function signaled an error.

The input-streams and output-streams arguments must be lists of streams or file descriptor integers or a single stream or file descriptor integer or `nil`. If both are `nil`, wait-for-io-available returns `nil` immediately.

The input-wait-function argument, if supplied, must be name a function which accepts one argument, which is applied to each item in the input-streams list before a system wait is initiated, and after a system wait returns. The default function is stream-listen.

The output-wait-function argument, if supplied, must name a function which accepts one argument, which is applied to each item in the output-streams list before a system wait is initiated, and after a system wait returns. The default function is an internal function that attempts to write an empty array of octets to the stream.

The whostate argument is used as the whostate during a system wait. The default value is "waiting for i/o".

The timeout argument must be `nil` or a number. `nil` specifies an indefinite wait, a number specifies a number of seconds.

When called, this function applies input-wait-function to every element of input-streams and output-wait-function to every element of output-streams. If any application errors or returns non-`nil`, then a list of all cases of erroring or returning non-`nil` is collected and returned, the list being as described above. (Of course, the information is based on when the functions are applied to the streams and the state may changed even before wait-for-io-available returns.)

If all applications of the functions return `nil`, a system wait is called that monitors all the specified I/O devices. When the system wait returns, the wait functions are again applied as above with a result being returned if any function call errors or returns non-`nil`. If timeout is a number, wait-for-io-available returns `nil` after that number of seconds. If timeout is `nil`, wait-for-io-available returns only when some application of a wait function errors or returns non-`nil`.

Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page is new in the 10.1 release.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 New since the initial 10.1 release.