[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Question about mailbox egg

From: Peter Bex
Subject: Re: [Chicken-users] Question about mailbox egg
Date: Sat, 21 Nov 2009 14:20:12 +0100
User-agent: Mutt/

On Sat, Nov 21, 2009 at 01:42:01AM -0800, Timothy Beyer wrote:
> Dear Chicken Users List,
> 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

You would never see exactly this. The consumer is another thread, not
the primordial one.

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

I'm not 100% sure but I think the scheduler simply never gets around to
invoking the consumer thread.  And because when the primordial thread
(the first thread that always exists) exits, the program quits, it is
never executed.

> Is there any easy way to get this behavior?

Try calling (thread-yield!) after writing.

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

You really should upgrade to Chicken 4 :)

"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth

reply via email to

[Prev in Thread] Current Thread [Next in Thread]