The mailbox egg does not work on my 2.3 build: it deadlocks on mailbox-wait! if the mailbox is empty.
$ csi ) ___ (__/_____) /) , /) / (/ _ (/_ _ __ / / )__(_(__/(___(/_/ (_ (______) Version 2, Build 3 - linux-unix-gnu-x86 - [ dload ptables ] (c)2000-2005 Felix L. Winkelmann ; loading /home/graham/.csirc ... #;1> (use mailbox) ; loading /usr/local/lib/chicken/mailbox.so ... ; loading library srfi-18 ... #;2> (define m (make-mailbox)) #;3> (mailbox-receive! m) Error: deadlock Call history: <eval> (mailbox-receive! m) <-- According to the docs, I would have expected the thread to suspend, awaiting a new message. The script below loads mailbox.scm, producing a better trace: ; simple-test.scm (load "mailbox.scm") (mailbox-receive! (make-mailbox)) $ csi -s ./simple-test.scm Warning: declarations are ignored in interpreted code (##core#declare (quote (disable-interrupts)) (quote (no-bound-checks)) (quote (fixnum))) Error: deadlock Call history: <eval> (require (quote extras) (quote srfi-18)) <eval> (mailbox-receive! (make-mailbox)) <eval> (make-mailbox) <eval> [make-mailbox] (##sys#make-structure (quote mailbox) (make-queue) (quote ()) (:optional name (gensym (quote mailbox)))) <eval> [make-mailbox] (make-queue) <eval> [make-mailbox] (null? g0) <eval> [make-mailbox] (gensym (quote mailbox)) <eval> (mailbox-wait! ch) <eval> [mailbox-wait!] (##sys#check-structure ch (quote mailbox) (quote mailbox-wait!)) <eval> [mailbox-wait!] (##sys#slot ch 1) <eval> [mailbox-wait!] (queue-empty? q) <eval> [mailbox-wait!] (##sys#setslot ch 2 (append (##sys#slot ch 2) (list ##sys#current-thread))) <eval> [mailbox-wait!] (append (##sys#slot ch 2) (list ##sys#current-thread)) <eval> [mailbox-wait!] (##sys#slot ch 2) <eval> [mailbox-wait!] (list ##sys#current-thread) <eval> [mailbox-wait!] (thread-suspend! ##sys#current-thread) <-- The example program on the mailbox-egg page also deadlocks -- but only once the mailbox is empty. The consumer loops through the four sent messages, and deadlocks on the fifth (mailbox-receive!) attempt. (A side-note about the example: if run as a standalone script, it needs to end with a thread-join! to the consumer thread, or the mailbox is never read. Perhaps that should be added on the help page?) Thanks, Graham _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users