Concurrency.select: def of bend-kit-concurrency@0.2.0.0 Import: import bend-kit-concurrency@0.2.0.0/concurrency.bend as Concurrency Lines 313-322 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=313&end_line=322 import Base # One channel that carries (i, value) for each value received on chans[i], in # the order they arrive. Chan.recv on it waits for whichever source is ready # first, and answers None once every source is closed. The selector owns the # receiving side of its sources. Close it to stop early: each relay then drops # the one value it holds, if any, and stops. def select(-A: Type, chans: List) -> IO(Chan(U32 & A)): do IO: out : Chan(U32 & A) <- Chan.new(U32 & A, 0) done : Chan(Unit) <- Chan.new(Unit, 0) select.go(A, chans, out, done) Uses (9): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Chan https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Chan.new 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=List 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 https://jend.leeeet.dev/definition.txt?path=bend-kit-concurrency@0.2.0.0/concurrency.bend&name=select.go