This is the mail archive of the
guile@sources.redhat.com
mailing list for the Guile project.
Re: continuation and multi-threading
- To: djurfeldt at nada dot kth dot se
- Subject: Re: continuation and multi-threading
- From: Keisuke Nishida <kxn30 at po dot cwru dot edu>
- Date: 02 Aug 2000 01:50:14 -0400
- Cc: guile at sourceware dot cygnus dot com
- 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> <xy7lmygcr57.fsf@mdj.nada.kth.se>
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.