summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheng Shao <cheng.shao@tweag.io>2021-01-18 14:44:28 +0000
committerCheng Shao <cheng.shao@tweag.io>2021-01-19 12:52:57 +0000
commit6cfdca9f014895a9962e1d077719a96842383000 (patch)
tree2f8fe2b1c5ecf40b74c1947d7797766553f3fbc6
parent9cc50a0fce206cfecb973c9b061a2912b2361d3e (diff)
downloadhaskell-6cfdca9f014895a9962e1d077719a96842383000.tar.gz
Correct documentation in System.Mem.Weak
[ci skip] Since #13167 is closed, exceptions thrown in finalizers are ignored and doesn't affect other finalizers in the same batch. This MR updates the documentation in System.Mem.Weak to reflect that.
-rw-r--r--libraries/base/System/Mem/Weak.hs28
1 files changed, 11 insertions, 17 deletions
diff --git a/libraries/base/System/Mem/Weak.hs b/libraries/base/System/Mem/Weak.hs
index 8d21eb59d9..654f18f655 100644
--- a/libraries/base/System/Mem/Weak.hs
+++ b/libraries/base/System/Mem/Weak.hs
@@ -147,22 +147,16 @@ A heap object is /reachable/ if:
{- $notes
A finalizer is not always called after its weak pointer\'s object becomes
-unreachable. There are two situations that can cause this:
-
- * If the object becomes unreachable right before the program exits,
- then GC may not be performed. Finalizers run during GC, so finalizers
- associated with the object do not run if GC does not happen.
-
- * If a finalizer throws an exception, subsequent finalizers that had
- been queued to run after it do not get run. This behavior may change
- in a future release. See issue <https://gitlab.haskell.org/ghc/ghc/issues/13167 13167>
- on the issue tracker. Writing a finalizer that throws exceptions is
- discouraged.
-
-Other than these two caveats, users can always expect that a finalizer
-will be run after its weak pointer\'s object becomes unreachable. However,
-the second caveat means that users need to trust that all of their
-transitive dependencies do not throw exceptions in finalizers, since
-any finalizers can end up queued together.
+unreachable. If the object becomes unreachable right before the program exits,
+then GC may not be performed. Finalizers run during GC, so finalizers associated
+with the object do not run if GC does not happen.
+
+Other than the above caveat, users can always expect that a finalizer will be
+run after its weak pointer\'s object becomes unreachable.
+
+If a finalizer throws an exception, the exception is silently caught without
+notice. See the commit of issue
+<https://gitlab.haskell.org/ghc/ghc/-/issues/13167 13167> for details. Writing a
+finalizer that throws exceptions is discouraged.
-}