def select

bend-kit-concurrency@0.2.0.0 · concurrency.bend:313

import bend-kit-concurrency@0.2.0.0/concurrency.bend as Concurrency
import Base

313# One channel that carries (i, value) for each value received on chans[i], in
314# the order they arrive. Chan.recv on it waits for whichever source is ready
315# first, and answers None once every source is closed. The selector owns the
316# receiving side of its sources. Close it to stop early: each relay then drops
317# the one value it holds, if any, and stops.
318def select(-A: Type, chans: List<Chan(A)>) -> IO(Chan(U32 & A)):
319  do IO<Chan(U32 & A)>:
320    out : Chan(U32 & A) <- Chan.new(U32 & A, 0)
321    done : Chan(Unit) <- Chan.new(Unit, 0)
322    select.go(A, chans, out, done)

Uses (9)

Used by (0)

No other definition uses this definition.