provide syntax for running select loop as async operation.
provide syntax for running select loop as async operation.
val receiver = gopherApi.select.forever{ case x: channel.read => Console.println(s"received:$x") }
provide syntax for running select loop inside go (or async) block example of usage:
provide syntax for running select loop inside go (or async) block example of usage:
go { ..... for(s <- gopherApi.select.forever) s match { case x: ch1.read => do something with x case q: chq.read => implicitly[FlowTermination[Unit]].doExit(()) case y: ch2.write if (y=expr) => do something with y case _ => do somethig when idle. }
Note, that you can use implicit instance of [FlowTermination[Unit]] to stop loop.
provide syntax for creating output channels.
provide syntax for creating output channels.
val multiplexed = for(s <- gopherApi.select.forever) yield s match { case x: channelA => s"A:${x}" case x: channelB => s"B:${x}" }
Builder for 'forever' selector. Can be obtained as
gopherApi.select.forever
.