gears.async.Channel
See theChannel companion object
trait Channel[T] extends SendableChannel[T], ReadableChannel[T], Closeable
A generic channel that can be sent to, received from and closed.
Attributes
- See also
-
SyncChannel, BufferedChannel and UnboundedChannel for channel implementations.
- Example
-
// send from one Future, read from multiple val ch = SyncChannel[Int]() val sender = Future: for i <- 1 to 20 do ch.send(i) ch.close() val receivers = (1 to 5).map: n => Future: boundary: while true: ch.read() match case Right(k) => println(s"Receiver $n got: $k") case Left(_) => boundary.break() receivers.awaitAll
- Companion
- object
- Graph
-
- Supertypes
-
trait Closeabletrait AutoCloseabletrait ReadableChannel[T]trait SendableChannel[T]class Objecttrait Matchableclass Any
- Known subtypes
Members list
In this article