Browse files

Switch to SafeSemaphore (QSem is deprecated in GHC 7.8)

  • Loading branch information...
1 parent 7c0cdf9 commit 4a7e0f6b4658e7d322856aa98fea20cec301f5e0 @nurpax committed May 6, 2014
Showing with 5 additions and 5 deletions.
  1. +5 −5 test/SafeCWD.hs
View
10 test/SafeCWD.hs
@@ -3,28 +3,28 @@ module SafeCWD
, removeDirectoryRecursiveSafe
) where
-import Control.Concurrent.QSem
+import Control.Concurrent.SSem
import Control.Exception
import Control.Monad
import System.Directory
import System.IO.Unsafe
-sem :: QSem
-sem = unsafePerformIO $ newQSem 1
+sem :: SSem
+sem = unsafePerformIO $ new 1
inDir :: Bool -> FilePath -> IO a -> IO a
inDir startClean dir action = bracket before after (const action)
where
before = do
- waitQSem sem
+ wait sem
cwd <- getCurrentDirectory
when startClean $ removeDirectoryRecursiveSafe dir
createDirectoryIfMissing True dir
setCurrentDirectory dir
return cwd
after cwd = do
setCurrentDirectory cwd
- signalQSem sem
+ signal sem
removeDirectoryRecursiveSafe :: String -> IO ()
removeDirectoryRecursiveSafe p =

0 comments on commit 4a7e0f6

Please sign in to comment.