Add more documentation

This commit is contained in:
Christopher Baines 2026-03-18 08:44:26 +00:00
parent 5b84273cbf
commit d3d4964210
4 changed files with 134 additions and 4 deletions

View file

@ -318,6 +318,12 @@ invocation of PROC finishes. REPORT is passed the results for each
(resource-pool parallelism-limiter-resource-pool))
(define* (make-parallelism-limiter limit #:key (name "unnamed"))
"Return a parallelism limiter that allows at most LIMIT concurrent
fibers to execute within @code{with-parallelism-limiter} at the same
time. Further fibers block until a slot becomes free.
@code{#:name} is a string used in log messages. Defaults to
@code{\"unnamed\"}."
(make-parallelism-limiter-record
(make-fixed-size-resource-pool
(iota limit)
@ -329,6 +335,9 @@ invocation of PROC finishes. REPORT is passed the results for each
parallelism-limiter)))
(define* (call-with-parallelism-limiter parallelism-limiter thunk)
"Acquire a slot from PARALLELISM-LIMITER, call THUNK, release the
slot, and return the values from THUNK. Blocks if no slot is
currently available."
(call-with-resource-from-pool
(parallelism-limiter-resource-pool parallelism-limiter)
(lambda _