projects
/
haskell-directory.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bfdd52d
)
[project @ 2002-10-18 16:29:18 by malcolm]
author
malcolm
<unknown>
Fri, 18 Oct 2002 16:29:18 +0000
(16:29 +0000)
committer
malcolm
<unknown>
Fri, 18 Oct 2002 16:29:18 +0000
(16:29 +0000)
Implement atomicModifyIORef for nhc98.
Data/IORef.hs
patch
|
blob
|
history
diff --git
a/Data/IORef.hs
b/Data/IORef.hs
index
af8ebda
..
9170faf
100644
(file)
--- a/
Data/IORef.hs
+++ b/
Data/IORef.hs
@@
-48,6
+48,7
@@
import NHC.IOExtras
, newIORef
, readIORef
, writeIORef
+ , excludeFinalisers
)
#endif
@@
-86,4
+87,11
@@
atomicModifyIORef = plainModifyIORef -- Hugs has no preemption
where plainModifyIORef r f = do
a <- readIORef r
case f a of (a',b) -> writeIORef r a' >> return b
+#elif defined(__NHC__)
+atomicModifyIORef r f =
+ excludeFinalisers $ do
+ a <- readIORef r
+ let (a',b) = f a
+ writeIORef r a'
+ return b
#endif