Package: alexandria
Macro unwind-protect-case
Lambda List
unwind-protect-case ((&optional abort-flag) protected-form &body clauses)
Syntax
Arguments
Return Value
the values of the protected-form
Details
Like unwind-protect, but you can specify the circumstances that the cleanup clauses are
run.
Clauses can be given in any order, and more than one clause can be given for each circumstance. The clauses whose denoted circumstance occured, are executed in the order the clauses appear.
abort-flag is the name of a variable that will be bound to t in clauses if the protected-form aborted preemptively, and to nil otherwise.
Clauses can be given in any order, and more than one clause can be given for each circumstance. The clauses whose denoted circumstance occured, are executed in the order the clauses appear.
abort-flag is the name of a variable that will be bound to t in clauses if the protected-form aborted preemptively, and to nil otherwise.
Examples
(unwind-protect-case () (protected-form) (:normal (format t "Evaluated if PROTECTED-FORM executed normally.~%")) (:abort (format t "Evaluated if PROTECTED-FORM aborted preemptively.~%")) (:always (format t "Evaluated in either case.~%")))
(unwind-protect-case (aborted-p) (protected-form) (:always (perform-cleanup-if aborted-p)))