Previous: , Up: SRFI-18   [Contents][Index]


7.5.15.5 SRFI-18 Exceptions

SRFI-18 exceptions are identical to the exceptions provided by Guile’s implementation of SRFI-34. The behavior of exception handlers invoked to handle exceptions thrown from SRFI-18 functions, however, differs from the conventional behavior of SRFI-34 in that the continuation of the handler is the same as that of the call to the function. Handlers are called in a tail-recursive manner; the exceptions do not “bubble up”.

Function: current-exception-handler

Returns the current exception handler.

Function: with-exception-handler handler thunk

Installs handler as the current exception handler and calls the procedure thunk with no arguments, returning its value as the value of the exception. handler must be a procedure that accepts a single argument. The current exception handler at the time this procedure is called will be restored after the call returns.

Function: raise obj

Raise obj as an exception. This is the same procedure as the same-named procedure defined in SRFI 34.

Function: join-timeout-exception? obj

Returns #t if obj is an exception raised as the result of performing a timed join on a thread that does not exit within the specified timeout, #f otherwise.

Function: abandoned-mutex-exception? obj

Returns #t if obj is an exception raised as the result of attempting to lock a mutex that has been abandoned by its owner thread, #f otherwise.

Function: terminated-thread-exception? obj

Returns #t if obj is an exception raised as the result of joining on a thread that exited as the result of a call to thread-terminate!.

Function: uncaught-exception? obj
Function: uncaught-exception-reason exc

uncaught-exception? returns #t if obj is an exception thrown as the result of joining a thread that exited by raising an exception that was handled by the top-level exception handler installed by make-thread. When this occurs, the original exception is preserved as part of the exception thrown by thread-join! and can be accessed by calling uncaught-exception-reason on that exception. Note that because this exception-preservation mechanism is a side-effect of make-thread, joining on threads that exited as described above but were created by other means will not raise this uncaught-exception error.


Previous: , Up: SRFI-18   [Contents][Index]