Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ara Adkins
Glasgow Haskell Compiler
Commits
58a05f60
Commit
58a05f60
authored
Mar 24, 2004
by
simonmar
Browse files
[project @ 2004-03-24 16:59:51 by simonmar]
Add caveat about finalizers (don't refer to Handles from finalizers).
parent
0dd193b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
libraries/base/GHC/ForeignPtr.hs
View file @
58a05f60
...
...
@@ -145,6 +145,12 @@ addForeignPtrConcFinalizer :: ForeignPtr a -> IO () -> IO ()
-- is an arbitrary @IO@ action. When it is invoked, the finalizer
-- will run in a new thread.
--
-- NB. Be very careful with these finalizers. One common trap is that
-- if a finalizer references another finalized value, it does not
-- prevent that value from being finalized. In particular, 'Handle's
-- are finalized objects, so a finalizer should not refer to a 'Handle'
-- (including @stdout@, @stdin@ or @stderr@).
--
addForeignPtrConcFinalizer
f
@
(
ForeignPtr
fo
r
)
finalizer
=
do
fs
<-
readIORef
r
writeIORef
r
(
finalizer
:
fs
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment