|
From: | David Janssens |
Subject: | [Chicken-users] multi-threading bug in udp egg? |
Date: | Sun, 13 Nov 2005 00:42:18 +0100 |
(require 'srfi-18 'udp)
(define (read-packets)
(let loop ()
(let ((s (udp-open-socket)))
(udp-bind! s #f 6666)
(receive (n data) (udp-recv s 2048)
(print "packet received"))
(loop))))
(thread-start! (make-thread read-packets 'read-packets))
(let loop ()
(thread-sleep! 5)
(print "beep")
(loop))
The result of running this program with debugging output from scheduler.scm is:
DBG: #<thread: primordial> blocks for 5328
DBG: scheduling, current: #<thread: primordial>, ready: (#<thread: read-packets>)
DBG: timeout (328) list: ((5328 . #<thread: primordial>))
DBG: #<thread: primordial> -> 5328
DBG: switching to #<thread: read-packets>
Obviously, there is a bug, since I would expect the message "beep" to be printed every 5 secs, independently of the read-packets thread. In this case, the udp-recv call seems to block everything.
I am running chicken 2.2 on cygwin (couldn't test on linux, sorry)
David Janssens
[Prev in Thread] | Current Thread | [Next in Thread] |