[MLton-user] signal handlers

Wesley W. Terpstra wesley at terpstra.ca
Sat Dec 1 13:27:43 PST 2007


On Dec 1, 2007, at 10:09 PM, Dave Herman wrote:
> But how do you actually trap them? I can't find the ML analog of  
> signal(...).

fun h () = print "hello world\n"
val () = MLton.Signal.setHandler (Posix.Signal.cont,
                                   MLton.Signal.Handler.simple h)

I don't believe it's possible to write a signal handler in SML97 (ie:  
you need MLton extensions). This is because signal handling requires  
some concept of asynchronous method invocation or multiple threads,  
both of which are not available in SML97.




More information about the MLton-user mailing list