Add more documentation
This commit is contained in:
parent
5b84273cbf
commit
d3d4964210
4 changed files with 134 additions and 4 deletions
|
|
@ -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 _
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue