Compare commits
2 commits
04d964a9f8
...
8100d36aa5
| Author | SHA1 | Date | |
|---|---|---|---|
| 8100d36aa5 | |||
| 9cce89fc01 |
1 changed files with 17 additions and 13 deletions
|
|
@ -558,8 +558,9 @@
|
||||||
(lambda (exn)
|
(lambda (exn)
|
||||||
;; This can happen if the resource pool is destroyed very
|
;; This can happen if the resource pool is destroyed very
|
||||||
;; quickly
|
;; quickly
|
||||||
(unless (resource-pool-destroyed-error? exn)
|
(if (resource-pool-destroyed-error? exn)
|
||||||
(raise-exception exn)))
|
#f
|
||||||
|
(raise-exception exn)))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(with-parallelism-limiter
|
(with-parallelism-limiter
|
||||||
return-new-resource/parallelism-limiter
|
return-new-resource/parallelism-limiter
|
||||||
|
|
@ -588,13 +589,11 @@
|
||||||
#:unwind? #t)))))
|
#:unwind? #t)))))
|
||||||
#:unwind? #t))))
|
#:unwind? #t))))
|
||||||
|
|
||||||
(define (spawn-fiber-to-destroy-resource resource-id resource-details)
|
(define (spawn-fiber-to-destroy-resource resource-id resource-value)
|
||||||
(spawn-fiber
|
(spawn-fiber
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(let loop ()
|
(let loop ()
|
||||||
(let* ((resource
|
(let* ((success?
|
||||||
(resource-details-value resource-details))
|
|
||||||
(success?
|
|
||||||
(with-exception-handler
|
(with-exception-handler
|
||||||
(lambda _ #f)
|
(lambda _ #f)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
|
@ -608,7 +607,7 @@
|
||||||
(print-backtrace-and-exception/knots exn)
|
(print-backtrace-and-exception/knots exn)
|
||||||
(raise-exception exn))
|
(raise-exception exn))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(start-stack #t (destructor resource))
|
(start-stack #t (destructor resource-value))
|
||||||
#t)))
|
#t)))
|
||||||
#:unwind? #t)))
|
#:unwind? #t)))
|
||||||
|
|
||||||
|
|
@ -662,7 +661,8 @@
|
||||||
destructor)
|
destructor)
|
||||||
(spawn-fiber-to-destroy-resource
|
(spawn-fiber-to-destroy-resource
|
||||||
resource-id
|
resource-id
|
||||||
(hash-ref resources resource-id)))
|
(resource-details-value
|
||||||
|
(hash-ref resources resource-id))))
|
||||||
|
|
||||||
(hash-remove! resources resource-id)
|
(hash-remove! resources resource-id)
|
||||||
|
|
||||||
|
|
@ -886,7 +886,8 @@
|
||||||
lifetime))
|
lifetime))
|
||||||
(begin
|
(begin
|
||||||
(spawn-fiber-to-destroy-resource resource-id
|
(spawn-fiber-to-destroy-resource resource-id
|
||||||
resource-details)
|
(resource-details-value
|
||||||
|
resource-details))
|
||||||
(loop next-resource-id
|
(loop next-resource-id
|
||||||
available
|
available
|
||||||
waiters))
|
waiters))
|
||||||
|
|
@ -956,7 +957,8 @@
|
||||||
(hash-ref resources
|
(hash-ref resources
|
||||||
resource-id)))
|
resource-id)))
|
||||||
(spawn-fiber-to-destroy-resource resource-id
|
(spawn-fiber-to-destroy-resource resource-id
|
||||||
resource-details)
|
(resource-details-value
|
||||||
|
resource-details))
|
||||||
|
|
||||||
(loop next-resource-id
|
(loop next-resource-id
|
||||||
available
|
available
|
||||||
|
|
@ -1033,7 +1035,8 @@
|
||||||
(lambda (resource-id)
|
(lambda (resource-id)
|
||||||
(spawn-fiber-to-destroy-resource
|
(spawn-fiber-to-destroy-resource
|
||||||
resource-id
|
resource-id
|
||||||
(hash-ref resources resource-id)))
|
(resource-details-value
|
||||||
|
(hash-ref resources resource-id))))
|
||||||
resources-to-destroy))
|
resources-to-destroy))
|
||||||
|
|
||||||
(loop next-resource-id
|
(loop next-resource-id
|
||||||
|
|
@ -1072,8 +1075,9 @@
|
||||||
(lambda (resource-id)
|
(lambda (resource-id)
|
||||||
(spawn-fiber-to-destroy-resource
|
(spawn-fiber-to-destroy-resource
|
||||||
resource-id
|
resource-id
|
||||||
(hash-ref resources
|
(resource-details-value
|
||||||
resource-id)))
|
(hash-ref resources
|
||||||
|
resource-id))))
|
||||||
available))
|
available))
|
||||||
|
|
||||||
;; Do this in parallel to avoid deadlocks between the
|
;; Do this in parallel to avoid deadlocks between the
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue