Release locks on abort

Fixes deadlock if hook_checkout returns ABORT.

One of these days I want to implement the abort mechanism through
exceptions, even though that means handling it explicitly in more
places. Or maybe *because* that means handling it explicitly in more
places.
This commit is contained in:
Juerd Waalboer 2023-01-16 01:17:33 +01:00
parent 094fbcb1db
commit 6089e212dc
2 changed files with 5 additions and 0 deletions

View file

@ -60,6 +60,10 @@ sub release_lock() {
}
}
sub release_all_locks() {
release_lock while $lockcount;
}
sub with_lock :prototype(&) ($code) {
get_lock;
my @rv;

View file

@ -143,6 +143,7 @@ OUTER: for (;;) {
@retry = ();
call_hooks "abort", $cart, \@_;
$cart->empty;
RevBank::FileIO::release_all_locks;
{ no warnings; redo OUTER; }
}