dstarcev
01/11/2017, 9:54 AMasync {
while (true) {
// suspend while asynchronously reading
val bytesRead = inFile.aRead(buf)
// continue when the reading is done
if (bytesRead == -1) break
...
process(buf, bytesRead)
// suspend while asynchronously writing
outFile.aWrite(buf)
// continue when the writing is done
...
}
}