[MLton] MLton.Thread.atomically

Matthew Fluet fluet@cs.cornell.edu
Fri, 26 Mar 2004 14:34:02 -0500 (EST)


> > Althogh certainly most of the time I would use MLton.Thread.atomically (if
> > we had it) I am worried about the fact that it is not going to call its
> > thunk argument as a tail call (of course) and that that might make it
> > unusable in some cases.  I guess in general nothing is as powerful as
> > atomicBegin/atomicEnd (or as easy to screw up).
>
> I guess the right thing is to have both.

Definitely.  And in serious multi-threaded cases, there are going to be
situations where you want to be in NonAtomic, switch threads, and upon
return, expect to be in Atomic 1, which you'll later atomicEnd down to
NonAtomic.  You can't express that with MLton.Thread.atomically, because
the nesting isn't right.