<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=GB2312" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Thanks for the reply, but I have some issues:<br>
<br>
(1) ready-only should be documented in the doc string.<br>
<br>
(2) If ready-only is just supposed to be about consing,<br>
it should not change any behavior other than that.<br>
<br>
(3) Why it is ever right for wait-for-input to return<br>
when there isn't any input? Is there something<br>
about the intent of :ready-only that would cause<br>
that behavior to be correct? (Not counting the<br>
EINTR case.)<br>
<br>
(4) Changing the behavior incompatibly from one<br>
release to the next is undesirable, in general.<br>
<br>
(5) In particular, our problem was that the<br>
call to usocket:wait-for-input was in a library<br>
that we use, rather than our own code, so<br>
the only way to fix the problem (until we<br>
were able to get a new version of the library<br>
that has been adjusted) was to modify it<br>
locally, which is somewhat undesirable.<br>
<br>
Thanks!<br>
<br>
-- Dan<br>
<br>
Chun Tian (binghe) wrote:
<blockquote cite="mid:93A2B043-5F0A-4127-B914-7F0CEAC134D4@gmail.com"
type="cite">
<pre wrap="">Hi, Daniel
I'm very sorry for the late response for your multiple posts on the :READY-ONLY keyword argument of WAIT-FOR-INPUT.
The short answer for you will be: always use (:READY-ONLY T), and ...
here is an formal answer from the original designer of WAIT-FOR-INPUT, Erik Huelsmann:
"""
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.
")
"""
In my opinion, this design is reasonable: for performance critical USOCKET applications, programmers should use (:READY-ONLY NIL), the default option, and check the status of each usocket in the waiting list, this prevents unnecessary runtime consing. For simple use, (:READY-ONLY T) is very convenient, you can just found which usocket is readable just from the return value (as a list) of WAIT-FOT-INPUT.
I hope this mail could solve your confusion.
Regards,
Chun Tian (binghe)
ÔÚ 2010-5-4£¬06:05£¬ Daniel Weinreb дµÀ£º
</pre>
<blockquote type="cite">
<pre wrap="">Hi. I just tried out the latest usocket. It's not working
properly for me, because wait-for-input returns true
even when there isn't any input.
If I change the default value of the :ready-only argument to
wait-for-input to t instead of nil, that fixes the problem.
I don't even understand why this argument
exists; no caller seems to pass it at all! What's going
on here?
Thanks.
-- Dan
_______________________________________________
usocket-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:usocket-devel@common-lisp.net">usocket-devel@common-lisp.net</a>
<a class="moz-txt-link-freetext" href="http://common-lisp.net/cgi-bin/mailman/listinfo/usocket-devel">http://common-lisp.net/cgi-bin/mailman/listinfo/usocket-devel</a>
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
</body>
</html>