Hi, usocket
Just found a bug on 0.4.x branch, on LispWorks (non-win32 version).
The WAIT-FOR-INPUT-INTERNAL function has a TRUNCATE operation on TIMEOUT:
(defun wait-for-input-internal (wait-list &key timeout) (with-mapped-conditions () ;; unfortunately, it's impossible to share code between ;; non-win32 and win32 platforms... ;; Can we have a sane -pref. complete [UDP!?]- API next time, please? (dolist (x (wait-list-waiters wait-list)) (mp:notice-fd (os-socket-handle x))) (mp:process-wait-with-timeout "Waiting for a socket to become active" (truncate timeout) ;; IT'S HERE!!!!!!!!!!!!!!!!!!!!!!!!! #'(lambda (socks) (let (rv) (dolist (x socks rv) (when (usocket-listen x) (setf (state x) :READ rv t))))) (wait-list-waiters wait-list)) (dolist (x (wait-list-waiters wait-list)) (mp:unnotice-fd (os-socket-handle x))) wait-list)))
So if I call WAIT-FOR-INPUT on a usocket instance with no TIMEOUT keyword supply, (TRUNCATE NIL) will be called, and error happens. How to fix this issue to make sure I can just wait "infinitely" on a usocket?
Regards,
Chun Tian (binghe)
On Sun, Sep 7, 2008 at 17:09, Chun Tian (binghe) binghe.lisp@gmail.com wrote:
So if I call WAIT-FOR-INPUT on a usocket instance with no TIMEOUT keyword supply, (TRUNCATE NIL) will be called, and error happens. How to fix this issue to make sure I can just wait "infinitely" on a usocket?
Not having tried it, but (and timeout (truncate timeout)) should do, no?
-Hans
在 2008-9-7,下午11:33, Hans Hübner 写道:
On Sun, Sep 7, 2008 at 17:09, Chun Tian (binghe) <binghe.lisp@gmail.com
wrote:
So if I call WAIT-FOR-INPUT on a usocket instance with no TIMEOUT keyword supply, (TRUNCATE NIL) will be called, and error happens. How to fix this issue to make sure I can just wait "infinitely" on a usocket?
Not having tried it, but (and timeout (truncate timeout)) should do, no?
I don't think so.
MP:PROCESS-WAIT-WITH-TIMEOUT must be called with a TIMEOUT parameter as integer (in seconds). If TIMEOUT is NIL, WAIT-FOR-INPUT-INTERNAL maybe should turn to call MP:PROCESS-WAIT instead of MP:PROCESS-WAIT- WITH-TIMEOUT:
http://www.lispworks.com/documentation/lw51/LWRM/html/lwref-445.htm
I made a patch based on above idea, as in attach, it works under simple test.
Regards,
Chun Tian (binghe)
Hi, usocket
Anyone review this patch? Should it be applied? (If sure, I'll commit it by myself)
--binghe
在 2008-9-7,23:46, Chun Tian (binghe) 写道:
在 2008-9-7,下午11:33, Hans Hübner 写道:
On Sun, Sep 7, 2008 at 17:09, Chun Tian (binghe) <binghe.lisp@gmail.com
wrote:
So if I call WAIT-FOR-INPUT on a usocket instance with no TIMEOUT keyword supply, (TRUNCATE NIL) will be called, and error happens. How to fix this issue to make sure I can just wait "infinitely" on a usocket?
Not having tried it, but (and timeout (truncate timeout)) should do, no?
I don't think so.
MP:PROCESS-WAIT-WITH-TIMEOUT must be called with a TIMEOUT parameter as integer (in seconds). If TIMEOUT is NIL, WAIT-FOR-INPUT-INTERNAL maybe should turn to call MP:PROCESS-WAIT instead of MP:PROCESS-WAIT- WITH-TIMEOUT:
http://www.lispworks.com/documentation/lw51/LWRM/html/lwref-445.htm
I made a patch based on above idea, as in attach, it works under simple test.
Regards,
Chun Tian (binghe)
<usocket-wfl-lispworks.diff>