--- On Wed, 10/29/08, SASADA Koichi <ko1 / atdot.net> wrote:

> From: SASADA Koichi <ko1 / atdot.net>
> Subject: [ruby-core:19609] Re: Future of Continuations
> To: ruby-core / ruby-lang.org
> Date: Wednesday, October 29, 2008, 2:21 PM
> Paul Brannan wrote:
> > They restore the state of the stack, not the state of
> the heap.  This is
> > the desired behavior.
> 
> right.
> 
> >> Further the use of continuations is limited to the
> thread they are
> >> created in. This seems to be caused by
> implementing continuations with
> >> threads.
> > 
> > Continuations are implemented with fibers on 1.9.
> 
> unright.
> 
> Fibers and Continuations are implemented by same way.  This
> does not
> mean Conts are impled by Fibers.
> 
> > They still cannot be
> > called across threads.  AFAIK changing this would be a
> huge undertaking,
> > because saving the C stack in one thread and restoring
> it in another
> > thread could result in objects being restored to a
> different place in
> > memory than they were created, or even duplicated C
> objects on the stack
> > that were not properly constructed/initialized.
> 
> maybe right.
> 
> -- 
> // SASADA Koichi at atdot dot net

This seems to assume that there is stack copying needed to make fibers work across threads, but it isn't clear that is the only way. If there is an indirect reference to thread local storage in the context of the fiber, there might be issues. Are there systems, libraries or structures where it is true?

--
Chetan