[MLton] thread model
Stephen Weeks
MLton@mlton.org
Wed, 2 Feb 2005 12:06:35 -0800
> > In the NJ
> > implementation of CML this would probably be done by capturing the
> > continuation at the scheduling point (the scheduler already uses callcc
> > so no extra work here), save it, then to restore the thread to the
> > continuation I have saved by placing the saved continuation on the
> > scheduling queue inplace of the current continuation for that thread.
> > The sceduler takes care of the rest (ignoring for now the heap etc).
> > With MLton's one shot continuations, is there a way to emulate this?
>
> Maybe, though you will need to dive deep into the threads implementation.
How about just using MLton.Cont? To "restore" a thread t1 to
continuation k, simply kill t1 and create a new thread t2 whose sole
behavior is to throw to k.