https://kotlinlang.org logo
#announcements
Title
# announcements
k

karelpeeters

08/13/2017, 7:07 AM
@napperley Yes, start a new Thread that runs the loop.
n

napperley

08/13/2017, 7:09 AM
How would the low CPU usage be achieved without resorting to the dreaded while (true) { // ... }
k

karelpeeters

08/13/2017, 7:16 AM
Use a
SyncronizedQueue<Event>
for the events, and just call
poll()
on it in the while loop, it will automatically wait until there are events and call
put(event)
when there's a new even, it will automatically resume the main loop.
n

napperley

08/13/2017, 9:33 AM
Appears as though readLine() doesn't work in Kotlin 1.1.3-2 (not in plain Kotlin programs). Should block to read in keyboard input (expected behaviour) but skips the process instead. Strange thing is readLine() works fine in the Kotlin REPL 😕 .
Rather disturbing that earlier Kotlin 1.1 versions are also affected by the same issue ☝️ .