summaryrefslogtreecommitdiff
path: root/compiler/main/SysTools.hs
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2015-01-27 16:20:54 -0800
committerEdward Z. Yang <ezyang@cs.stanford.edu>2015-01-28 13:54:58 -0800
commit07ee96faac4996cde0ab82789eec0b70d1a35af0 (patch)
tree1a36efc948d7634a95734d0c527286a5070f4c76 /compiler/main/SysTools.hs
parent276da7929c187f007c198a38e88bdad91866e500 (diff)
downloadhaskell-07ee96faac4996cde0ab82789eec0b70d1a35af0.tar.gz
Use strict atomicModifyIORef' (added in GHC 7.6).
Summary: Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: austin, hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D635
Diffstat (limited to 'compiler/main/SysTools.hs')
-rw-r--r--compiler/main/SysTools.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs
index a1209c77ca..56eba69333 100644
--- a/compiler/main/SysTools.hs
+++ b/compiler/main/SysTools.hs
@@ -1034,7 +1034,7 @@ cleanTempDirs dflags
= unless (gopt Opt_KeepTmpFiles dflags)
$ mask_
$ do let ref = dirsToClean dflags
- ds <- atomicModifyIORef ref $ \ds -> (Map.empty, ds)
+ ds <- atomicModifyIORef' ref $ \ds -> (Map.empty, ds)
removeTmpDirs dflags (Map.elems ds)
cleanTempFiles :: DynFlags -> IO ()
@@ -1042,7 +1042,7 @@ cleanTempFiles dflags
= unless (gopt Opt_KeepTmpFiles dflags)
$ mask_
$ do let ref = filesToClean dflags
- fs <- atomicModifyIORef ref $ \fs -> ([],fs)
+ fs <- atomicModifyIORef' ref $ \fs -> ([],fs)
removeTmpFiles dflags fs
cleanTempFilesExcept :: DynFlags -> [FilePath] -> IO ()
@@ -1050,7 +1050,7 @@ cleanTempFilesExcept dflags dont_delete
= unless (gopt Opt_KeepTmpFiles dflags)
$ mask_
$ do let ref = filesToClean dflags
- to_delete <- atomicModifyIORef ref $ \files ->
+ to_delete <- atomicModifyIORef' ref $ \files ->
let (to_keep,to_delete) = partition (`elem` dont_delete) files
in (to_keep,to_delete)
removeTmpFiles dflags to_delete
@@ -1058,7 +1058,7 @@ cleanTempFilesExcept dflags dont_delete
-- Return a unique numeric temp file suffix
newTempSuffix :: DynFlags -> IO Int
-newTempSuffix dflags = atomicModifyIORef (nextTempSuffix dflags) $ \n -> (n+1,n)
+newTempSuffix dflags = atomicModifyIORef' (nextTempSuffix dflags) $ \n -> (n+1,n)
-- Find a temporary name that doesn't already exist.
newTempName :: DynFlags -> Suffix -> IO FilePath
@@ -1120,7 +1120,7 @@ getTempDir dflags = do
-- 2. Update the dirsToClean mapping unless an entry already exists
-- (i.e. unless another thread beat us to it).
- their_dir <- atomicModifyIORef dir_ref $ \mapping ->
+ their_dir <- atomicModifyIORef' dir_ref $ \mapping ->
case Map.lookup tmp_dir mapping of
Just dir -> (mapping, Just dir)
Nothing -> (Map.insert tmp_dir our_dir mapping, Nothing)
@@ -1141,7 +1141,7 @@ getTempDir dflags = do
addFilesToClean :: DynFlags -> [FilePath] -> IO ()
-- May include wildcards [used by DriverPipeline.run_phase SplitMangle]
addFilesToClean dflags new_files
- = atomicModifyIORef (filesToClean dflags) $ \files -> (new_files++files, ())
+ = atomicModifyIORef' (filesToClean dflags) $ \files -> (new_files++files, ())
removeTmpDirs :: DynFlags -> [FilePath] -> IO ()
removeTmpDirs dflags ds