Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Continuation questions

2 views
Skip to first unread message

kyd...@gmail.com

unread,
Dec 11, 2008, 10:54:17 AM12/11/08
to
Hi,

Trying to get something working using continuations. I have the
following setup:
function capture() {
globals.x = new Continuation()
}

function test() {
//some code
capture()
//some code part 2
}

What I want to achieve is after capturing the continuation using
"capture()" in function test, I want to suspend the execution of
function test, untill I call globals.x() at some point.

This "point" can be a lot of time later in the program.

I haven't been able to find any way to do this, except throwing an
error and at high level in my program capture such errors and do
nothing with them.

Am I missing something?

I looked for docs/samplecode, but the only thing I found that was
remotely usefull was http://wiki.apache.org/cocoon/RhinoWithContinuations,
but it didn't answer this question.

Tnx in advance,

K.

Attila Szegedi

unread,
Dec 11, 2008, 10:57:17 AM12/11/08
to kyd...@gmail.com, dev-tech-js-...@lists.mozilla.org
Define a continuation on the global level, and then invoke it:

var __terminateInterpreter__ = new Continuation();

function captureAndSuspend() {
globals.x = new Continuation();
__terminateInterpreter__();
}

Attila.

--
home: http://www.szegedi.org
twitter: http://twitter.com/szegedi
weblog: http://constc.blogspot.com

kyd...@gmail.com

unread,
Dec 11, 2008, 11:33:21 AM12/11/08
to
> > remotely usefull washttp://wiki.apache.org/cocoon/RhinoWithContinuations

> > ,
> > but it didn't answer this question.
>
> > Tnx in advance,
>
> > K.

Tnx!

K.

0 new messages