Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
pretty
Commits
5c556caf
Commit
5c556caf
authored
Jan 11, 2006
by
simonmar
Browse files
[project @ 2006-01-11 11:29:49 by simonmar]
add some more warnings about unsafeThaw
parent
4cb31389
Changes
1
Hide whitespace changes
Inline
Side-by-side
Data/Array/Base.hs
View file @
5c556caf
...
...
@@ -1673,14 +1673,20 @@ thawSTUArray (UArray l u arr) = do
Note that because the array is possibly not copied, any subsequent
modifications made to the mutable version of the array may be
shared with the immutable version. It is safe to use, therefore, if
the immutable version is never referenced again.
shared with the immutable version. It is only safe to use,
therefore, if the immutable array is never referenced again in this
thread, and there is no possibility that it can be also referenced
in another thread. If you use an unsafeThaw/write/unsafeFreeze
sequence in a multi-threaded setting, then you must ensure that
this sequence is atomic with respect to other threads, or a garbage
collector crash may result (because the write may be writing to a
frozen array).
The non-copying implementation is supported between certain pairs
of array types only; one constraint is that the array types must
have identical representations. In GHC, The following pairs of
array types have a non-copying O(1) implementation of
'unsafe
Freeze
'. Because the optimised versions are enabled by
'unsafe
Thaw
'. Because the optimised versions are enabled by
specialisations, you will need to compile with optimisation (-O) to
get them.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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