projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4201e0f
)
Make consIORef atomic.
author
Thomas Schilling
<nominolo@googlemail.com>
Sat, 22 Aug 2009 23:09:37 +0000
(23:09 +0000)
committer
Thomas Schilling
<nominolo@googlemail.com>
Sat, 22 Aug 2009 23:09:37 +0000
(23:09 +0000)
compiler/utils/Util.lhs
patch
|
blob
|
history
diff --git
a/compiler/utils/Util.lhs
b/compiler/utils/Util.lhs
index
37aedc8
..
d8b61f8
100644
(file)
--- a/
compiler/utils/Util.lhs
+++ b/
compiler/utils/Util.lhs
@@
-79,9
+79,8
@@
module Util (
import Panic
-import Data.IORef ( IORef, newIORef )
+import Data.IORef ( IORef, newIORef, atomicModifyIORef )
import System.IO.Unsafe ( unsafePerformIO )
-import Data.IORef ( readIORef, writeIORef )
import Data.List hiding (group)
import Control.Concurrent.MVar ( MVar, newMVar, newEmptyMVar )
@@
-696,8
+695,7
@@
global a = unsafePerformIO (newIORef a)
\begin{code}
consIORef :: IORef [a] -> a -> IO ()
consIORef var x = do
- xs <- readIORef var
- writeIORef var (x:xs)
+ atomicModifyIORef var (\xs -> (x:xs,()))
\end{code}
\begin{code}