This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: continuation and multi-threading


Mikael Djurfeldt <mdj@mdj.nada.kth.se> writes:

> > Right.  Hmm, after all, supporting continuations is not very trivial..
> 
> But not very hard either...  :)
> 
> continuations.c:219:
> 
> SCM
> scm_call_continuation (SCM cont, SCM val)
> {
>   if ((SCM_SEQ (cont) != SCM_SEQ (scm_rootcont))
>       || (SCM_BASE (cont) != SCM_BASE (scm_rootcont)))  
>     /* base compare not needed */
>     scm_wta (cont, "continuation from wrong top level", s_cont);
>   
>   scm_dowinds (SCM_DYNENV (cont),
> 	       scm_ilength (scm_dynwinds) - scm_ilength (SCM_DYNENV (cont)));
>   
>   scm_dynthrow (cont, val);
>   return SCM_UNSPECIFIED; /* not reached */
> }
> 
> scm_dowinds moves up or down (by adding frames from SCM_DYNENV (cont))
> the current dynwind chain (scm_dynwinds) to sync it with SCM_DYNENV (cont).
> 
> The common type of frame has a CAR part which is called when moving
> into dynamic context, while the CDR part is called when moving out.

Yes, maybe I need to do the same thing.  I also need to cope with the
catch/throw mechanism.  I'll think about it next.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]