#line 284 "/home/travis/build/felix-lang/felix/src/packages/fibres.fdoc"
  
  Schannel multiplexor.
  Read multiple input schannels, write to an output schannel.
  open class Multiplexor
  {
    Schannel copy.
    noinline proc copy[T] (i:ischannel[T],o:oschannel[T]) ()
    {
      while true do
        var x = read i;
        write (o,x);
      done
    }
  
    Schannel multiplexor based on iterator argument.
    Accepts stream of input schannels.
    Writes to output schannel.
    proc mux[T] (inp:1->opt[ischannel[T]], out:oschannel[T]) ()
    {
      for i in inp do
        spawn_fthread$ copy(i,out);
      done
    }
  
  
    Schannel multiplexor based on streamable data structure.
    Creates stream of input schannels.
    Writes to output schannel.
    fun mux[C,T with Streamable[C,ischannel[T]]] (a:C, out:oschannel[T]) =>
      mux (iterator a, out)
    ;
  }