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


Keisuke Nishida <kxn30@po.cwru.edu> writes:

> Mikael Djurfeldt <mdj@mdj.nada.kth.se> writes:
> 
> > > Is your VM using a stack of its own?  In that case, you might have to
> > > take a copy of both stacks.
> > 
> > (I.e., VM stack and C stack.)
> 
> Could I use setjump?

Sure.  This is what is being used now.  This is the implementation of
call/cc in Guile (from eval.c:2232 with irrelevant details edited out):

	case (SCM_ISYMNUM (SCM_IM_CONT)):
	  scm_make_cont (&t.arg1);
	  if (setjmp (SCM_JMPBUF (t.arg1)))
	    {
	      SCM val;
	      val = SCM_THROW_VALUE (t.arg1);
	      return val;
	    }
	  proc = SCM_CDR (x);
	  proc = evalcar (proc, env);
	  goto evap1; /* apply proc on t.arg1 */

BTW, what did you mean with 'arranges the return value'?

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