summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/Weak/Finalize.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-05-03 15:29:04 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-05-19 04:57:51 -0400
commit372cf7305157df7bbe41d2d1f45211d9b999ff52 (patch)
tree51b84bf3f4770b30a44ca86c30530b6af7d4e3e7 /libraries/base/GHC/Weak/Finalize.hs
parentcfc8e2e2e3c9d9044f8f4d100c102b005695905f (diff)
downloadhaskell-372cf7305157df7bbe41d2d1f45211d9b999ff52.tar.gz
base: Throw exceptions raised while closing finalized Handles
Fixes #21336.
Diffstat (limited to 'libraries/base/GHC/Weak/Finalize.hs')
-rw-r--r--libraries/base/GHC/Weak/Finalize.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/libraries/base/GHC/Weak/Finalize.hs b/libraries/base/GHC/Weak/Finalize.hs
index 09308fb3d3..d16277248b 100644
--- a/libraries/base/GHC/Weak/Finalize.hs
+++ b/libraries/base/GHC/Weak/Finalize.hs
@@ -49,6 +49,8 @@ runFinalizerBatch (I# n) arr =
handleFinalizerExc <- getFinalizerExceptionHandler
handleFinalizerExc se `catchException` (\(SomeException _) -> return ())
+-- See Note [Handling exceptions during Handle finalization] for the
+-- motivation for this mechanism.
finalizerExceptionHandler :: IORef (SomeException -> IO ())
finalizerExceptionHandler = unsafePerformIO $ newIORef (const $ return ())
{-# NOINLINE finalizerExceptionHandler #-}