All Manuals > LispWorks® User Guide and Reference Manual > 47 The SYSTEM Package

wait-for-input-streams Function


Waits for input on a list of socket streams, returning those that are ready.




wait-for-input-streams streams &key wait-function wait-reason timeout => result

A list, each member of which is a socket-stream.
A function of no arguments.
A string.
A real number or nil.
A list of socket-streams or nil.

The function wait-for-input-streams waits for any of the streams in the argument streams to be ready for input. "Ready for input" typically means that some input is available from the stream, but can also means that the peer closed the connection or there is an attempt to connect to the socket. Note that this function first checks the buffer for buffered streams.

When any of the streams is ready for input, wait-for-input-streams returns a list of all the streams that are ready, in the same order that they appear in streams.

If timeout is non-nil it must be a real number, specifying a timeout in seconds. If timeout seconds pass and none of the streams is ready, wait-for-input-streams returns nil.

If timeout is 0, wait-for-input-streams returns all of the streams that are ready immediately, without waiting at all. That is, it behaves like listen on many streams.

If wait-function is supplied, it is called periodically with no arguments, and if it returns non-nil then wait-for-input-streams returns nil. Note that, like the wait-function argument of process-wait, wait-function is called often and on other threads, so need to be an inexpensive call and independent of dynamic context.

If wait-reason is supplied it is used as the &WAIT-REASON for the Lisp process that calls wait-for-input-streams while it is waiting.


wait-for-input-streams may return the list streams that was passed to it as is, if all the streams are ready.

See also


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:31:02