Tweak the resource pool

Mostly to no longer sleep in the main fiber. Now the main fiber just
spawns other fibers when it would previously block on put-operation
and these other fibers communicate back to the main resource pool
fiber when necessary.

This should mean that the resource pool is more responsive.
This commit is contained in:
Christopher Baines 2025-01-08 15:57:30 +00:00
parent 59c183b13f
commit dcb56ee2c5
2 changed files with 340 additions and 258 deletions

View file

@ -15,6 +15,19 @@
res)
2))))
(run-fibers-for-tests
(lambda ()
(let ((resource-pool (make-resource-pool
(lambda ()
2)
1
#:add-resources-parallelism 1)))
(assert-equal
(with-resource-from-pool resource-pool
res
res)
2))))
(let* ((error-constructor
(record-constructor &resource-pool-timeout))
(err