[MLton] interrupted system call

Stephen Weeks MLton@mlton.org
Sat, 27 Mar 2004 09:51:32 -0800


> The restart loop is a lot of overhead to keep around for control
> flow paths that can never be reached.  The {restart:bool} argument
> to syscall asserts that a particular system call will never need to
> be restarted.  It should be the case that every syscall call passes
> either true or false (the constants).

Ah.  That makes sense.

> I think we've uncovered enough corner cases in system calls to warrant
> having one workhorse function with all the logic and special instances for
> the most common cases.

Definitely.

> I don't agree with your abstraction.  I proposed:
> 
>     signature M =
>        sig
>           val m : (('a -> 'b) * ('b -> 'c)) -> ('a -> 'c)
>        end
> 
>     signature S =
>        sig
>           val s : ('a -> 'b * (unit -> 'c)) -> ('a -> 'c)
>        end

You're right.  That'll teach me to try to just convert the arguments.
Your code also explains why I was confused about the "manual closure
conversion".  It isn't necessary, one can simply return the closure
from pre and have post invoke it.

> Simply because I believe they correspond to distinct phases in the
> execution of a system call.  You're right that nothing interesting happens
> at the boundaries; the execution goes right from pre to call, and from
> call right to return or post.

OK.  It feels weird to me, but I understand what's going on, and it's
only syntax.