Next: , Previous: Asyncs, Up: Scheduling

5.17.3 Continuation Barriers

The non-local flow of control caused by continuations might sometimes not be wanted. You can use with-continuation-barrier etc to errect fences that continuations can not pass.

— Scheme Procedure: with-continuation-barrier proc
— C Function: scm_with_continuation_barrier (proc)

Call proc and return its result. Do not allow the invocation of continuations that would leave or enter the dynamic extent of the call to with-continuation-barrier. Such an attempt causes an error to be signaled.

Throws (such as errors) that are not caught from within proc are caught by with-continuation-barrier. In that case, a short message is printed to the current error port and #f is returned.

Thus, with-continuation-barrier returns exactly once.

— C Function: void * scm_c_with_continuation_barrier (void *(*func) (void *), void *data)

Like scm_with_continuation_barrier but call func on data. When an error is caught, NULL is returned.