legate.core.Runtime.add_shutdown_callback#
- Runtime.add_shutdown_callback(
- self,
- callback: ShutdownCallback,
Add a shutdown callback to be executed on Legate program finalization.
Shutdown callbacks are only executed during normal program shutdown, and will not run if e.g. the program ends by exception or abort.
Shutdown callbacks are executed in LIFO order. Callbacks may themselves register additional shutdown callbacks during their execution, though given the LIFO order, this means that the very next callback will be the function that was just registered.
It is possible to register the same callback multiple times. No attempt is made to deduplicate these.
- Parameters:
callback (ShutdownCallback) – The callback to register.