It would be very inconvenient to rewrite the code to to check for interrupts as you suggest.
The built-in SIGINT handler does almost what I want, because it stops execution of the main thread and also allows throwing the Interrupt exception. So it looks like it is implemented with some primitives that are not available to the programmer. Any chance those could be exported, somehow? Or perhaps another standard signal handler could be made available that simply raises the Interrupt exception?
This is presently not a high priority, because I decided to leave the standard SIGINT handler in place, in which case it is up to the user to just type `f'.
- Frank
Frank> Along similar lines: I have a Twelf top-level function in Frank> server that should interrupt the current computation and return Frank> to the Twelf top-level, not to an ML debugger or the ML Frank> top-level. I saw the documentation on signals, but I don't see Frank> how to achieve the desired effect because the handler will be Frank> run in a different thread.
I was just thinking about this the other day. I don't think it's currently possible in PolyML to handle asynchronous events - the garbage collector probably assumes it can't happen. So the best approximation I came up with was to code a trivial signal handler in C that sets an "interrupted" flag and checking that flag periodically in my main loop.
Of course, that assumes you have an identifiable "main loop" other than the toplevel ...
-- Ian Zimmerman, Oakland, California, U.S.A. if (sizeof(signed) > sizeof(unsigned) + 4) { delete this; } GPG: 433BA087 9C0F 194F 203A 63F7 B1B8 6E5A 8CA3 27DB 433B A087 _______________________________________________ polyml mailing list polyml@inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml