Creates, names, and registers a shutdown hook to run the given code.
Creates, names, and registers a shutdown hook to run the given code.
Capture Checking notes: shutdown hooks capture capabilities until the end of the programs. Therefore, such hooks cannot capture scoped capabilities. While classifying global capabilities is under progress (see scala/scala3#27196), we require shutdown hooks to be pure. To include global resources (e.g. for cleanup), mark them pure using unsafeAssumePure.
Value parameters
body
the code to execute when the JVM shuts down
Attributes
Returns
the newly created and registered ShutdownHookThread