GHC.Internal.Weak.Finalize

ghc-internal-9.1001.0: Basic libraries

Safe Haskell | Unsafe
Language | Haskell2010

GHC.Internal.Weak.Finalize

Contents

- Handling exceptions
- Internal

Synopsis

- setFinalizerExceptionHandler :: (SomeException -> IO ()) -> IO ()
- getFinalizerExceptionHandler :: IO (SomeException -> IO ())
- printToHandleFinalizerExceptionHandler :: Handle -> SomeException -> IO ()
- runFinalizerBatch :: Int -> Array# (State# RealWorld -> State# RealWorld) -> IO ()

# Handling exceptions

When an exception is thrown by a finalizer called by the garbage collector, GHC calls a global handler which can be set with `setFinalizerExceptionHandler`. Note that any exceptions thrown by this handler will be ignored.

setFinalizerExceptionHandler :: (SomeException -> IO ()) -> IO () Source #

Set the global action called to report exceptions thrown by weak pointer finalizers to the user.

@since base-4.18.0.0

getFinalizerExceptionHandler :: IO (SomeException -> IO ()) Source #

Get the global action called to report exceptions thrown by weak pointer finalizers to the user.

@since base-4.18.0.0

printToHandleFinalizerExceptionHandler :: Handle -> SomeException -> IO () Source #

An exception handler for `Handle` finalization that prints the error to the given `Handle`, but doesn't rethrow it.

@since base-4.18.0.0

# Internal

runFinalizerBatch :: Int -> Array# (State# RealWorld -> State# RealWorld) -> IO () Source #

Run a batch of finalizers from the garbage collector. We're given an array of finalizers and the length of the array, and we just call each one in turn.