Next: iklib compensations, Previous: iklib syntaxes, Up: iklib [Index]
Unwind–protection allows operations to be performed synchronously with respect to the dynamic extent of a call to thunk; the mechanism is sophisticated because there are multiple, sophisticated ways to exit the dynamic extent of a function call. The typical application is to release resources, like input/output ports and database connections. Allocating and releasing resources, for an overview of resource management under Vicare.
To understand the unwind–protection mechanism we must understand the concepts “dynamic extent of a function call” and “dynamic environment” ad defined by R6RS (see scheme basic dynamic extent). Notes on the dynamic environment.
The unwind–protection mechanism described here is used by
Vicare in: the implementation of compensations (see iklib compensations); the implementation of the syntax try
(see iklib syntaxes try); the implementation of condition handlers
and restarts ((vicare-libs)Signalling conditions and restarts).
NOTE The unwind protection mechanism may misbehave in some cases, so do not trust it blindly (see iklib unwind-protect problems).
• iklib unwind-protect intro: | Introduction to the unwind protection mechanism. | |
• iklib unwind-protect syntaxes: | Unwind-protection syntaxes. | |
• iklib unwind-protect dynamic: | On the meaning of dynamic extent termination. | |
• iklib unwind-protect except 1: | Raising non-continuable exceptions from the thunk. | |
• iklib unwind-protect except 2: | Raising continuable exceptions from the thunk. | |
• iklib unwind-protect except 3: | Raising exceptions from the unwind handler. | |
• iklib unwind-protect loops: | Use with loop syntaxes. | |
• iklib unwind-protect returnable: | Use with returnable bodies. | |
• iklib unwind-protect coroutines: | Use with coroutines. | |
• iklib unwind-protect reenter: | Handling reentering continuations. | |
• iklib unwind-protect dyn-env: | Clean-up thunks and the dynamic environment. | |
• iklib unwind-protect problems: | Known problems. | |
• iklib unwind-protect call/cc: | Unwinding call/cc .
|
Next: iklib compensations, Previous: iklib syntaxes, Up: iklib [Index]