mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-10 22:01:52 +09:00
Former-commit-id: b1168a53fd5fbd09c6a5a76506402560fc4e0fd7 Former-commit-id: a0d455da14a6eb7bf0127e136949273ec5a28628
23 lines
611 B
Kotlin
23 lines
611 B
Kotlin
package net.torvald.terrarum.virtualcomputer.terminal
|
|
|
|
import net.torvald.terrarum.virtualcomputer.computer.TerrarumComputer
|
|
import java.io.InputStream
|
|
|
|
/**
|
|
* Created by minjaesong on 16-09-10.
|
|
*/
|
|
class TerminalInputStream(val host: TerrarumComputer) : InputStream() {
|
|
|
|
override fun read(): Int {
|
|
//System.err.println(Thread.currentThread().name)
|
|
// would display "LuaJ Separated", which means this InputStream will not block main thread
|
|
|
|
host.openStdin()
|
|
synchronized(this) {
|
|
(this as java.lang.Object).wait()
|
|
}
|
|
|
|
return host.stdinInput
|
|
}
|
|
|
|
} |