[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] mailbox: not working on 2.3?
From: |
Thomas Chust |
Subject: |
Re: [Chicken-users] mailbox: not working on 2.3? |
Date: |
Wed, 12 Apr 2006 15:34:39 +0000 (GMT) |
On Wed, 12 Apr 2006, Graham Fawcett wrote:
The mailbox egg does not work on my 2.3 build: it deadlocks on
mailbox-wait! if the mailbox is empty. [...]
Hello,
I think this is not a bug, but rather a desired behaviour. When you
execute mailbox-receive! and the message queue is empty, the calling
thread suspends. But as there are no other threads running, the scheduler
realizes that the calling thread will never become active again and thus
signals a deadlock exception.
If you tried your example with a running background thread instead, you
should get eternal blocking in mailbox-receive!. The scheduler has no way
of checking whether or not another running thread might queue objects in
the mailbox.
$ csi
[...]
Version 2, Build 308 - macosx-unix-gnu-ppc - [ libffi dload ptables ]
(c)2000-2006 Felix L. Winkelmann
; loading ./.csirc ...
#;1> (require-extension (srfi 18) mailbox)
; loading library srfi-18 ...
; loading /usr/local/lib/chicken/1/mailbox.so ...
#;2> (thread-start! (make-thread (rec (again) (thread-sleep! 3) (print "ping!")
(again))))
#<thread: thread2>
#;3> (print "pong: " (mailbox-receive! (make-mailbox)))
ping!
ping!
ping!
[...]
cu,
Thomas