e
Size: a a a
e
Д
e
AG
AB
VP
System.exit()
при чтении символа из System.in
МК
System.exit()
при чтении символа из System.in
И
System.exit()
при чтении символа из System.in
И
fun main() {Ну то есть, условно говоря, что-то такое
val mainThread = thread {
var i = 0
while (i < 1_000_000 && !Thread.currentThread().isInterrupted) {
try {
Thread.sleep(1000)
} catch (e: InterruptedException) {
break
}
println(i)
i += 1
}
// some cleanup here
}
val controlThread = thread(isDaemon = true) {
System.`in`.read()
mainThread.interrupt()
}
mainThread.join()
}
AE