setup_call_cleanup/4

setup_call_cleanup(: Setup,: Goal, : CleanUpGoal)*

Calls (once(Setup), Goal). For each sucessful execution of Setup, calling Goal, YAP will call the cleanup handler with ignore(_Cleanup_). The goal is guaranteed to be called exactly once. This will happen after Goal completes, either through failure, deterministic success, commit, or an exception. Setup will contain the goals that need to be protected from asynchronous interrupts such as the ones received from call_with_time_limit//22 or thread_signal//22. In most uses, Setup will perform temporary side-effects required by Goal that are finally undone by Cleanup.