@jwe just added the ability to change the function associated with an unwind_action object after it has been created.
When a cleanup function is installed with an unwind_action, and the code correctly executes the block that it was protecting, the unwind_action function needs to be cleared so that it no longer executes. Right now that is done by calling set
without at argument to set the function to NULL
as in unwind_action.set ()
.
For code clarity, would it be useful to have an alias for this construct which shows the programmer’s intention? For unwind_protect frames there was a function discard
. Thus, at the end of successfully running a block of code one could call frame.discard ()
which makes it clear that the frame is no longer needed. Alternatively, instead of set with a null argument it might be good to have a function unset
defined in the header file for unwind_action which is the equivalent of set()
.