LispWorks User Guide and Reference Manual > 40 The SYSTEM Package

NextPrevUpTopContentsIndex

wait-for-input-streams

Function
Summary

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

Package

system

Signature

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

Arguments

streams

A list, each member of which is a socket-stream.

wait-function

A function of no arguments.

wait-reason

A string.

timeout

A real number or nil .

Values

result

A list of socket-streams or nil .

Description

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 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.

Notes

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

See also

wait-for-input-streams-returning-first


LispWorks User Guide and Reference Manual - 22 Dec 2009

NextPrevUpTopContentsIndex