(* interrupts.sig *) (* Copyright (C) 2007 Alley Stoughton This file is part of crypto, a cryptogram encoder/decoder. See the file COPYING.txt for copying and usage restrictions *) (* interrupt handling *) signature INTERRUPTS = sig (* ignore f saves the current handling action for interrupts (the default action is termination), begins ignoring interrupts, and then evaluates f() if this evaluation yields the value v, then ignore restores the saved action for interrupts, and then returns v if this evaluation raises the exception ex, then ignore restores the saved action for interrupts, and then raises ex f() should not do any explicit interrupt processing, and should not call ignore *) val ignore : (unit -> 'a) -> 'a (* track f evaluates f() while keeping track of interrupts if this evaluation yields the value v, then track clears the interrupt signaling record, and then returns v if this evaluation raises the exception ex, then track clears the interrupt signaling record, and then raises ex f() should not do any explicit interrupt processing, and should not call ignore or track any input/output operations performed by f() should be done in protected mode (see the function protect, below) *) val track : (unit -> 'a) -> 'a (* protect f evaluates f() in PROTECTED MODE (also see track, above) f() should not do any interrupt processing either directly or using any of these functions *) val protect : (unit -> 'a) -> 'a (* check() checks whether any interrupts have been signaled, returning true (and clearing the interrupt signaling record) if the answer is yes, and returning false, otherwise *) val check : unit -> bool end;