[usocket-devel] wait-for-input's ready-only argument

Erik Huelsmann ehuels at gmail.com
Fri Dec 18 20:45:32 UTC 2009


Hi Mihai,

On Wed, Dec 16, 2009 at 12:00 PM, Mihai Bazon <mihai at bazon.net> wrote:
> Hi folks,
>
> What's with the ready-only arg to wait-for-input?  It's not documented
> anywhere, but I noticed that if I don't pass T for it my code behaves
> strangely.

Without the READ-ONLY arg, WAIT-FOR-INPUT will return all sockets in
the original list you passed it. This prevents a new list from being
consed up. Some users of USOCKET were reluctant to use it if it
wouldn't behave that way, expecting it to cost significant performance
to do the associated garbage collection.

Without the READ-ONLY arg, you need to check the socket STATE slot for
the values documented in usocket.lisp in the usocket class:

(state
    :initform nil
    :accessor state
    :documentation "Per-socket return value for the `wait-for-input' function.

The value stored in this slot can be any of
 NIL          - not ready
 :READ        - ready to read
 :READ-WRITE  - ready to read and write
 :WRITE       - ready to write

The last two remain unused in the current version.
")

HTH,

Erik.




More information about the usocket-devel mailing list