- // FEATURE: make sure that this can only be called from the Scheduler...
- /** if you enqueue a function, it gets invoked in its own pauseable context */
- public void perform() throws JSExn {
- Interpreter i = new Interpreter(this, true, new Interpreter.JSArgs(this));
- i.resume();
+ // FIXME: what needs to be syncrhonized (if anything)?
+ private Interpreter runner = null;
+ public Object run(Object o) throws JSExn {
+ if (runner == null) runner = new Interpreter(this, true, emptyArgs);
+ Object ret = runner.run(o);
+ if (runner.f == null) runner = null;
+ return ret;
+ }
+ public void pause() throws NotPausableException {
+ if (runner == null) throw new NotPausableException();
+ runner.pause();