[usocket-devel] :timeout NIL for wait-for-input returns immediately on SBCL

Chaitanya Gupta mail at chaitanyagupta.com
Wed Dec 24 08:03:51 UTC 2008


Chun Tian (binghe) wrote:
> So, to make UNIX-FAST-SELECT wait for ever, both TIMEOUT-SECS and 
> TIMEOUT-USECS must be NIL. I think your patch is right, that's a 
> usocket bug.
>
> Commited to trunk as r483, thanks very much!
>

Cool!

I did take a look at the source code of unix-fast-select. The thing that 
concerned me was,

(unless *interrupts-enabled*
  (note-dangerous-select))

under the T clause of the cond. Having looked at things a bit more 
closely now, I think I do understand better what this means.

Cheers,
Chaitanya

> --binghe
>
> On 2008-12-24, at 01:13, Chaitanya Gupta wrote:
>
>> Hi,
>>
>> On SBCL, providing :timeout NIL to wait-for-input returns immediately 
>> even when there is no input on any of the provided sockets (the 
>> documentation says it should wait indefinitely).
>>
>> Attached is a patch (svn diff) which fixes this, but I am not very 
>> sure about how sb-unix:unix-fast-select works, so its be best if 
>> someone who knows better can review it before committing this patch. :)
>>
>> Cheers,
>> Chaitanya
>>
>> Index: backend/sbcl.lisp
>> ===================================================================
>> --- backend/sbcl.lisp    (revision 482)
>> +++ backend/sbcl.lisp    (working copy)
>> @@ -353,7 +353,7 @@
>>                 (1+ (reduce #'max (wait-list-%wait sockets)
>>                             :key 
>> #'sb-bsd-sockets:socket-file-descriptor))
>>                 (sb-alien:addr rfds) nil nil
>> -                (when timeout secs) musecs)
>> +                (when timeout secs) (when timeout musecs))
>>          (if (null count)
>>          (unless (= err sb-unix:EINTR)
>>            (error (map-errno-error err)))
>> _______________________________________________
>> usocket-devel mailing list
>> usocket-devel at common-lisp.net
>> http://common-lisp.net/cgi-bin/mailman/listinfo/usocket-devel
>
> -- 
> Chun Tian (binghe)
> NetEase.com, Inc.
> P. R. China
>
>





More information about the usocket-devel mailing list