Alexander Romanov
12/18/2018, 4:11 PMval queueListener = launch {
while (isActive) {
// do something
}
}
Runtime.getRuntime().addShutdownHook(Thread {
<http://logger.info|logger.info> { "Cancellation requested" }
queueListener.cancel()
})
queueListener.join()
<http://logger.info|logger.info> { "Exiting program" }
why would “Exiting program” never show up?
are there any other way to do it? I am also considering channel that sends some cancellation event. But what wold be the better way to handle this?streetsofboston
12/18/2018, 4:16 PMyield()
statement inside your while(isActive)
loop…Alexander Romanov
12/19/2018, 7:39 AMstreetsofboston
12/19/2018, 1:00 PMAlexander Romanov
12/20/2018, 12:36 PM