Don't call put-message without unwinding the stack
When handling exceptions, as this is error prone.
This commit is contained in:
parent
e1858dfff5
commit
8c0f04be4f
1 changed files with 17 additions and 2 deletions
|
@ -650,12 +650,27 @@ available. Return the resource once PROC has returned."
|
|||
(lambda ()
|
||||
(with-exception-handler
|
||||
(lambda (exn)
|
||||
(print-backtrace-and-exception/knots exn)
|
||||
;; Unwind the stack before calling put-message, as
|
||||
;; this avoids inconsistent behaviour with
|
||||
;; continuation barriers
|
||||
(put-message (resource-pool-channel pool)
|
||||
`(return ,resource))
|
||||
(raise-exception exn))
|
||||
(lambda ()
|
||||
(proc resource))))
|
||||
(with-exception-handler
|
||||
(lambda (exn)
|
||||
(match (fluid-ref %stacks)
|
||||
((stack-tag . prompt-tag)
|
||||
(let ((stack (make-stack #t
|
||||
0 prompt-tag
|
||||
0 (and prompt-tag 1))))
|
||||
(raise-exception
|
||||
(make-exception
|
||||
exn
|
||||
(make-knots-exception stack)))))))
|
||||
(lambda ()
|
||||
(proc resource))))
|
||||
#:unwind? #t))
|
||||
(lambda vals
|
||||
(put-message (resource-pool-channel pool)
|
||||
`(return ,resource))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue