diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2015-06-21 17:28:52 +0200 | 
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2015-06-21 17:28:52 +0200 | 
| commit | 9f0212528bba3fd57088a0a99ec17856681a2c90 (patch) | |
| tree | 856b05f810574f849b16a6a7e93ddbea8e587dfc /src | |
| parent | 947861a186cb0d057c23df4d89f8b03045055751 (diff) | |
| download | trivmix-9f0212528bba3fd57088a0a99ec17856681a2c90.tar trivmix-9f0212528bba3fd57088a0a99ec17856681a2c90.tar.gz trivmix-9f0212528bba3fd57088a0a99ec17856681a2c90.tar.bz2 trivmix-9f0212528bba3fd57088a0a99ec17856681a2c90.tar.xz trivmix-9f0212528bba3fd57088a0a99ec17856681a2c90.zip  | |
build fixes
Diffstat (limited to 'src')
| -rw-r--r-- | src/Trivmix.hs | 6 | 
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Trivmix.hs b/src/Trivmix.hs index 79b3804..96e578b 100644 --- a/src/Trivmix.hs +++ b/src/Trivmix.hs  | |||
| @@ -165,7 +165,7 @@ handleFiles :: INotify -> MVar Level -> [FilePath] -> IO () | |||
| 165 | handleFiles inotify level files = do | 165 | handleFiles inotify level files = do | 
| 166 | initLevel <- readMVar level | 166 | initLevel <- readMVar level | 
| 167 | levelChanges <- (newChan :: IO (Chan Level)) | 167 | levelChanges <- (newChan :: IO (Chan Level)) | 
| 168 | stderrLock <- newMVar | 168 | stderrLock <- newMVar) () | 
| 169 | let | 169 | let | 
| 170 | handleFile file = do | 170 | handleFile file = do | 
| 171 | levelChanges' <- dupChan levelChanges | 171 | levelChanges' <- dupChan levelChanges | 
| @@ -220,7 +220,7 @@ readLevel :: Chan Level -> MVar Level -> FilePath -> MVar () -> IO () | |||
| 220 | readLevel levelChan current file stderrLock = catch action handler | 220 | readLevel levelChan current file stderrLock = catch action handler | 
| 221 | where | 221 | where | 
| 222 | action = do | 222 | action = do | 
| 223 | level <- withFileLock file Shared $ readFile file >>= readIO . stripSpace | 223 | level <- withFileLock file Shared $ const $ readFile file >>= readIO . stripSpace | 
| 224 | oldLevel <- readMVar current | 224 | oldLevel <- readMVar current | 
| 225 | when (oldLevel /= level) $ do | 225 | when (oldLevel /= level) $ do | 
| 226 | writeChan levelChan level | 226 | writeChan levelChan level | 
| @@ -239,7 +239,7 @@ readLevel levelChan current file stderrLock = catch action handler | |||
| 239 | else l | 239 | else l | 
| 240 | 240 | ||
| 241 | writeLevel :: FilePath -> MVar () -> Level -> IO () | 241 | writeLevel :: FilePath -> MVar () -> Level -> IO () | 
| 242 | writeLevel file stderrLock level = withFileLock file Exclusive $ do | 242 | writeLevel file stderrLock level = withFileLock file Exclusive $ const $ do | 
| 243 | withMVarLock stderrLock $ | 243 | withMVarLock stderrLock $ | 
| 244 | hPutStrLn stderr $ "Writing out level ‘" ++ (show level) ++ "’ to ‘" ++ file ++ "’" | 244 | hPutStrLn stderr $ "Writing out level ‘" ++ (show level) ++ "’ to ‘" ++ file ++ "’" | 
| 245 | writeFile file (show level ++ "\n") | 245 | writeFile file (show level ++ "\n") | 
