Dear Chicken Users List,

I am writing a program that needs message passing, so I ran the example for the 
mailbox egg.

For some reason, when I run the following example code on the egg wiki page:

(require-extension mailbox)

(define (consumer ch)
  (make-thread
    (lambda ()
      (let loop () 
        (print (current-thread) ": reading " (mailbox-receive! ch))
        (loop) ) ) ) )

(define ch (make-mailbox))
(thread-start! (consumer ch))
(for-each
  (lambda (x)
    (print (current-thread) ": writing " x)
    (mailbox-send! ch x) )
  '(33 44 55 hello) )

I get the following output:

#<thread: primordial>: writing 33
#<thread: primordial>: writing 44
#<thread: primordial>: writing 55
#<thread: primordial>: writing hello

Instead of what I expected to see:

#<thread: primordial>: writing 33
#<thread: primordial>: reading 33
#<thread: primordial>: writing 44
#<thread: primordial>: reading 44 
#<thread: primordial>: writing 55
#<thread: primordial>: reading 55
#<thread: primordial>: writing hello
#<thread: primordial>: reading hello

Is the consumer thread just thunked such that it's code never excecutes?

Is there any easy way to get this behavior?

My apologies if I overlooked anything obvious.  I'm still using chicken 3.5.2, 
if that helps.

Regards,
Tim


_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to