[gambit-list] non blocking IO bug ?

Marc Feeley feeley at iro.umontreal.ca
Mon Aug 6 20:19:16 EDT 2007


On 6-Aug-07, at 2:09 PM, Adrien Pierard wrote:

> Hi !
>
> I'm having some trouble with simple sockets operations, and I'm not  
> sure
> whether this is a bug, or whether I definitely misunderstood the
> documentation.

No, it's a bug in the tcp-server port implementation.  To fix it, in  
procedure ##make-tcp-server-port in file lib/_io.scm, replace the lines:

                        ;; the read would block, so wait and then try  
again

                        (macro-port-mutex-unlock! port)
                        (let ((continue?
                               (or (##wait-for-io!
                                    (macro-tcp-server-port-rdevice- 
condvar port)
                                    (macro-port-rtimeout port))
                                   ((macro-port-rtimeout-thunk port)))))
                          (macro-port-mutex-lock! port) ;; regain  
access to port
                          (if continue?
                            (loop)
                            #!eof)))

with

                        ;; the read would block, so wait and then try  
again

                        (macro-port-mutex-unlock! port)
                        (let ((continue?
                               (or (##wait-for-io!
                                    (macro-tcp-server-port-rdevice- 
condvar port)
                                    (macro-port-rtimeout port))
                                   ((macro-port-rtimeout-thunk port)))))
                          (if continue?
                            (begin
                              (macro-port-mutex-lock! port) ;; regain  
access to port
                              (loop))
                            #!eof)))

I noticed a few other cases like this in lib/_io.scm .  They will be  
fixed in the next release.

Marc




More information about the Gambit-list mailing list