write

suspend fun write(bytes: ByteArray, offset: Int = 0, length: Int = bytes.size - offset)

Adds a copy of length bytes of bytes from offset, so bytes is free again when this returns. Waits while the pipe is full. Call it from one producer at a time.

Throws

kotlinx.coroutines.CancellationException

after the engine closed the reader, so a producer coroutine ends quietly.