Make resource pool changes and add parallelism limiter
All checks were successful
/ test (push) Successful in 11s

This was motivated by trying to allow for completely cleaning up
resource pools, which involved removing their use of fiberize which
currently has no destroy mechanism.

As part of this, there's a new parallelism limiter mechanism using
resource pools rather than fibers, and also a fixed size resource
pool.

The tests now drain? and destroy the resource pools to check cleaning
up.
This commit is contained in:
Christopher Baines 2025-06-25 18:46:46 +02:00
parent edf62414ee
commit 37280c95f1
5 changed files with 613 additions and 97 deletions

View file

@ -4,7 +4,7 @@
#:export (run-fibers-for-tests
assert-no-heap-growth))
(define (run-fibers-for-tests thunk)
(define* (run-fibers-for-tests thunk #:key (drain? #t))
(let ((result
(run-fibers
(lambda ()
@ -12,6 +12,7 @@
(lambda (exn)
exn)
(lambda ()
(simple-format #t "running ~A\n" thunk)
(with-exception-handler
(lambda (exn)
(backtrace)
@ -20,7 +21,8 @@
#t)
#:unwind? #t))
#:hz 0
#:parallelism 1)))
#:parallelism 1
#:drain? drain?)))
(if (exception? result)
(raise-exception result)
result)))