summaryrefslogtreecommitdiff
path: root/libraries/base/Control
diff options
context:
space:
mode:
authorMarcin Szamotulski <profunctor@pm.me>2021-01-11 19:32:09 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-02-13 21:28:13 -0500
commit4b068fc3f62550de80b6f832fa05ff31914b1232 (patch)
tree96a6ba4ca6288865ea93ea047be646dedbd39bc0 /libraries/base/Control
parent8e2f85f6b4662676f0d7addaff9bf2c7d751bb63 (diff)
downloadhaskell-4b068fc3f62550de80b6f832fa05ff31914b1232.tar.gz
Improve bracket documentation
Diffstat (limited to 'libraries/base/Control')
-rw-r--r--libraries/base/Control/Exception/Base.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/libraries/base/Control/Exception/Base.hs b/libraries/base/Control/Exception/Base.hs
index 0d69d6f272..a390418458 100644
--- a/libraries/base/Control/Exception/Base.hs
+++ b/libraries/base/Control/Exception/Base.hs
@@ -214,6 +214,14 @@ onException io what = io `catch` \e -> do _ <- what
--
-- > withFile name mode = bracket (openFile name mode) hClose
--
+-- Implementation of bracket is using 'mask', which means that the release
+-- handler should be uninterruptible to run to completion in presence of
+-- asynchronous exceptions. 'hClose' is uninterruptible if used
+-- non-concurrently, closing a socket (from \"network\" package) is
+-- uninterruptible as well, an example of interruptible close handler is
+-- 'killThread' which should be wrapped using 'uninterruptibleMask_' when used
+-- with 'bracket'. Comments in 'uninterruptibleMask' still aply.
+--
bracket
:: IO a -- ^ computation to run first (\"acquire resource\")
-> (a -> IO b) -- ^ computation to run last (\"release resource\")