Concurrency.pool: def of bend-kit-concurrency@0.2.0.0 Import: import bend-kit-concurrency@0.2.0.0/concurrency.bend as Concurrency Lines 230-241 of bend-kit-concurrency@0.2.0.0/concurrency.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-concurrency@0.2.0.0/concurrency.bend&start_line=230&end_line=241 import Base # Runs work(s, x) for every x in xs, on one worker per state in states. A # worker owns its state and threads it through its jobs, so an affine handle # such as a connection pool is never shared. Answers the final states in # worker order and the results in the order of xs. def pool( ~S: Type, ~A: Type, ~B: Type, ~work: S -> A -> IO(S & B), states: List, xs: List ) -> IO(List & List): match states: case Nil{}: IO.die(List & List, 1, "Conc.pool: no workers") case s <> rest: pool.run(~S, ~A, ~B, ~work, s <> rest, count(A, xs)) Uses (6): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.die https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=bend-kit-concurrency@0.2.0.0/concurrency.bend&name=count https://jend.leeeet.dev/definition.txt?path=bend-kit-concurrency@0.2.0.0/concurrency.bend&name=pool.run