addShutdownHook

fun Runtime.addShutdownHook(block: () -> Unit)