Concurrency.select.close: def of bend-kit-concurrency@0.2.0.0 Import: import bend-kit-concurrency@0.2.0.0/concurrency.bend as Concurrency Lines 294-304 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=294&end_line=304 import Base # Closes out once all n relays have reported. def select.close(-A: Type, n: Nat, +out: Chan(U32 & A), +done: Chan(Unit)) -> IO(Unit): match n: case 0n: do IO: Chan.close(U32 & A, out) Chan.close(Unit, done) case 1n+p: do IO: got : Maybe<&1, Unit> <- Chan.recv(Unit, done) select.close(A, p, out, done) Uses (10): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Chan https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Chan.close https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Chan.recv https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Unit