[previous] [up] [next]     [contents] [index]
Next: Error Escape Handler Up: Exceptions and Control Flow Previous: Dynamic Wind

User Breaks

A ``user'' break is an asynchonous exception, usually triggered by an external source controlled by the user. A user break exception can only occur when user breaks are allowed by the break-enabled parameter (see section 9.4.1.10). When a user break is detected, the exn:misc:user-break exception is raised.

A user-break is triggered when the break-thread procedure is applied to a thread, or when the current user-break polling handler returns #t. The user-break polling handler is periodically invoked to poll for user breaks. (For example, a user-break polling handler might check to see if control-c was pressed.) A user-break polling handler takes no arguments and returns #f to continue the current evaluation. A user-break polling handler is installed with the user-break-poll-handler parameter (see section 9.4.1.10).

A user-break can occur while an exception handler is executing only if both the break-enabled and exception-break-enabled parameters are #t. Note that the handling procedures supplied to with-handlers are not exception handlers, so breaking within such procedures is allowed by break-enabled.

(dynamic-enable-break thunk) invokes thunk with breaking allowed; on exit from thunk, the enable state is restored.[footnote]



PLT