Paul Woitaschek
07/03/2020, 1:36 PM@Test
fun pipe() {
val pipe = Pipe(Long.MAX_VALUE)
thread {
val sink = pipe.sink.buffer()
repeat(10){i ->
Thread.sleep(1000)
sink.writeInt(i)
}
}
val source = pipe.source.buffer()
while (true) {
println(source.readInt())
}
}