forsyth20121205-174063a80cc13 years agoHistory
65 lines · 2.0 KB · Text
RawDownload
.TH EXCEPTION 2.SH NAMEexception \- obtain data about exceptions and set exception-handling modes.SH SYNOPSIS.EXinclude "exception.m";exc := load Exception Exception->PATH; NOTIFYLEADER, PROPAGATE: con iota; getexc:	fn(pid: int): (int, string, string);setexcmode:	fn(mode: int): int;.EE.SH DESCRIPTION.B Exceptionprovides functions to fetch data about exceptions in other processesand change exception-handling modes.It encapsulates exception-related operations on files in.IR prog (3)..PPWhen a process incurs an exception, the system saves details before processing the exception,following Limbo's rules..B Getexcreturns a tuple.BI ( pc,\ module,\ description )that describes the most recent exception raised in process.IR pid .(A process id of -1 is taken to mean the current process.)The tuple contains the pc value, the module name, and the exception name.The value.B "(0,\ nil,\ nil)"is returned if no exception has occurred..PPBy default, when a process incurs an exception that is not handled —no.B exceptionclause matches that exception —the process is stopped in a `Broken' state for debugging,and the exception does not propagate further..B Setexcmodechanges the way that the system handles exceptions for the current processand those it later spawns.A.I modeof.BR NOTIFYLEADERmakes the invoking process the leader of thecurrent process group for exception handling.Subsequently, an exception in any process in the current process groupwill atomically destroy all processes in the group except the leader,and the exception will be raised in the leader.(This works even when the leader itself incurs the exception.)A.I modeof.B PROPAGATEinstead causes an exception in any process in the group to be raised inall processes in the group, allowing them all to initiate local error recovery(ie, within each process)..SH SOURCE.B /appl/lib/exception.b.SH DIAGNOSTICSBoth functions return -1 on error and set the system error string..SH SEE ALSO.IR prog (3)