This is the mail archive of the
guile@sources.redhat.com
mailing list for the Guile project.
Re: continuation and multi-threading
- To: Keisuke Nishida <kxn30 at po dot cwru dot edu>
- Subject: Re: continuation and multi-threading
- From: Mikael Djurfeldt <mdj at mdj dot nada dot kth dot se>
- Date: 02 Aug 2000 04:51:00 +0200
- Cc: Russell McManus <russell dot mcmanus at msdw dot com>, djurfeldt at nada dot kth dot se, guile at sourceware dot cygnus dot com
- Cc: djurfeldt at nada dot kth dot se
- References: <m3g0oqnjrp.fsf_-_@indy.STUDENT.CWRU.Edu><m3d7jxa9gv.fsf@indy.STUDENT.CWRU.Edu><p2tpunx85vu.fsf@bohne.zrz.tu-berlin.de><m33dksvk8i.fsf@indy.STUDENT.CWRU.Edu><200007311359.NAA00736@ruebe.zrz.tu-berlin.de><AD4WUXvScB@khim.sch57.msk.ru> <m3wvi2m0pw.fsf@indy.STUDENT.CWRU.Edu><87punux90c.fsf@piracy.red-bean.com><m3ya2h1vk4.fsf@indy.STUDENT.CWRU.Edu><873dkpwmw5.fsf@piracy.red-bean.com><m3vgxlo5db.fsf@indy.STUDENT.CWRU.Edu><xy73dkohlvy.fsf@mdj.nada.kth.se><m3ittkpxav.fsf@indy.STUDENT.CWRU.Edu> <jqasnsomou4.fsf@msdw.com><m31z08be5f.fsf@indy.STUDENT.CWRU.Edu>
- Reply-To: djurfeldt at nada dot kth dot se
Keisuke Nishida <kxn30@po.cwru.edu> writes:
> Russell McManus <russell.mcmanus@msdw.com> writes:
>
> > If you want to support dynamic-wind in combination with continuations,
> > there is some additional book keeping to be done, and winding and
> > unwinding thunks to call. 'Essentials of Programming Languages',
> > Section 9.5 has a discussion of this topic.
>
> 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.