ShutdownHookThread

scala.sys.ShutdownHookThread
See theShutdownHookThread companion class
Capability trackingThis object was compiled with capability tracking enabled.Learn more

Attributes

Companion
class
Source
ShutdownHookThread.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply(body: ->=> Unit): ShutdownHookThread

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

Source
ShutdownHookThread.scala